Should "rv_value = 'submit'." force processing of the Setter method?.

When new values are entered into the field 'Country' for the Account screen the code associated with this field does not seem to be run unless I press ENTER after the field is populated from the list of values.
I have a method with the appropriate code to force it to process:
method GET_P_COUNTRY.
case iv_property.
when if_bsp_wd_model_setter_getter=>fp_server_event.
  rv_value = 'submit'.
endcase.
endmethod
I was under the illusion that this should force the Setter code to be executed, as though I had manually hit ENTER within the field.
I have just placed a break point in the GET_P_COUNTRY method and can see that the rv_value field is never being set. The iv_property is never matching the value from  if_bsp_wd_model_setter_getter=>fp_server_event.
The method is being called multiple times with the iv_property being equal to:
'fieldType'
'onclick'
'tooltip'
'DetailLink'
'focus'
'disableSVH'
and if_bsp_wd_model_setter_getter=>fp_server_event having a value of 'ServerEvent'.
What might be the best way of detecting that a value has been chosen from the pull-down list and then trigger the SET_COUNTRY method?.
Jason

Ah, It's not a manual input and is indeed a drop-down. The Country field is one of the SAP standard fields which, via config, displays a drop-down list of values to choose from. Once chosen it then updates the Country description.
Within the SET_COUNTRY method I detect if the country value has been changed, and if so set a boolean variable called ZCountry_flag to 'X'. This attribite is created against the class for the context node of the Country attribute.
Then, within the controller impl class I have entered code against the do_prepare_output method to detect whether the ZCountry_flag field is set, and then if so get data from ERP and post it into a Z-field, which is actually in a different context node, but for the same controller class. The ZCountry_flag attribute is then cleared.
This process works fine after I have selected a country code from the drop-down and then hit ENTER, but I need a way to emulate hitting ENTER after a value is selected from the list.
I hope that makes sense.
I could just moved the code from the do_prepare_output of the controller class to one of the Save related methods, but then this will only update the other fields when saving.

Similar Messages

  • JAXB is not generating the setter method for my tag

    Hi,
    I am generating java classes form my .xsd file using JAXB.
    The xsd definition has defnes a Form as a sequence of FormElement, where FormElement is a choice of graphical components like text etc. Form can have 0 or unbounded elements of typeFormElement
    Example
    <xs:element ref="sswfm:FormElement" minOccurs="0" maxOccurs="unbounded"/>
    It is creating the getter method for this tag like this-
    java.util.List getFormElement();
    but does not create setter method, namely, setFormElements which I would like to use when marshalling from swing to XML.
    If i remove the maxOccurs="unbounded, it is creating the setter method for this tag.But i want to keep this tag as it it and needs the setter method also.
    What should i do? Has one tried this before. HELP if you can
    Thank you in advance.

    Hi RavindraKshirsagar,
    We have a problem like you faced. Our requirement is that, we need to generate dynamically the PERSON element in our javabean.
    <xs:element name='SERVICE_REQUESTER'>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref='ORGANIZATION' />
                        <xs:element ref='PERSON' maxOccurs='unbounded' />
                   </xs:sequence>
              </xs:complexType>
         </xs:element>For this maxOccurs, as JAXB is not generating any Setter Method. As we need to get data dynamically from external application. If you could help us in handling this case dynamically, it will be well and good.
    Please send us the script / code asap.

  • About the setting method of  Instant Messaging(collabo4.01)

    Please teach me the setting method of Instant Messaging ID ( yahoo ).
    Although an icon is displayed, it will not be in an offline state.

    Hi,
    You can debug you JSPDynpage either from NWDS with the help of break points or by writing log statements in your code which will be written in defaultTrace log file.
    Check this to debug from NWDS:
    NetWeaver Portal Debugging
    Check this to write log statements:
    http://help.sap.com/saphelp_nw70/helpdata/EN/b0/003c41325fa831e10000000a1550b0/frameset.htm
    Netweaver Portal Log Configuration & Viewing (Part 3)
    Regards,
    Praveen Gudapati

  • Where is the "set" method for this ELEMENT?

    Hi
    I'm trying to understand the relationship between the DTD and XJS, and the JAXB generated code.
    Consider the example DTD, XJS, and generated source code (i.e., "value07.java") for ELEMENT value07, below ...
    QUESTION#1: Why is there no "set" method generated for ELEMENT "value07a" within the generated value07.java ???
    QUESTION#2: How to I code the DTD/XJS in order to force the generation of a "set" method in value07.java???.
    -- I want to be able to set a new value for ELEMENT "value07a" in order to generate an XML document containing the new value!!
    (NOTE: the reason that ELEMENT value07 (as well as other ELEMENTs) has only a single subelement, is in order to satisfy the XSLT definition in a preexisting application.)
    * * * this is the DTD* * *
    <!ELEMENT request                          (value01,value02,value03,value04,value05?,value06?,value07?,value08?,value09?,value10?,value11?,value12?,value13?,value14?,value15?,value16?,value17?,value18?)>
    <!ELEMENT value01                          (#PCDATA)>
    <!ELEMENT value02                          (#PCDATA)>
    <!ELEMENT value03                          (#PCDATA)>
    <!ELEMENT value04                          (value04a, value04b?)>
    <!ELEMENT value04a                          (#PCDATA)>
    <!ELEMENT value04b                          (#PCDATA)>
    <!ELEMENT value05                          (value05a, value05b?)>
    <!ELEMENT value05a                          (#PCDATA)>
    <!ELEMENT value05b                          (#PCDATA)>
    <!ELEMENT value06                          (value06a+)>
    <!ELEMENT value06a                          (#PCDATA)>
    <!ELEMENT value07                          (value07a+)>
    <!ELEMENT value07a                          (#PCDATA)>
    <!ELEMENT value08                          (value08a+)>
    <!ELEMENT value08a                          (#PCDATA)>
    <!ELEMENT value09                          (value09a+)>
    <!ELEMENT value09a                          (#PCDATA)>
    <!ELEMENT value10                          (value10a+)>
    <!ELEMENT value10a                          (#PCDATA)>
    <!ELEMENT value11                          (value11a+)>
    <!ELEMENT value11a                          (#PCDATA)>
    <!ELEMENT value12                          (value12a+)>
    <!ELEMENT value12a                          (#PCDATA)>
    <!ELEMENT value13                          (value13a+)>
    <!ELEMENT value13a                          (#PCDATA)>
    <!ELEMENT value14                          (value14a+)>
    <!ELEMENT value14a                          (#PCDATA)>
    <!ELEMENT value15                          (value15a+)>
    <!ELEMENT value15a                          (#PCDATA)>
    <!ELEMENT value16                          (value16a+)>
    <!ELEMENT value16a                          (#PCDATA)>
    <!ELEMENT value17                          (value17a+)>
    <!ELEMENT value17a                          (#PCDATA)>
    <!ELEMENT value18                          (value18a+)>
    <!ELEMENT value18a                          (#PCDATA)>
    * * * this is the XJS * * *
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE xml-java-binding-schema SYSTEM "http://java.sun.com/dtd/jaxb/1.0-ea/xjs.dtd">
    <xml-java-binding-schema version="1.0-ea">
    <options package="testSourceCode"/>
    <element name="request" type="class" root="true"/>
         <element name="value01"                               type="value"/>
         <element name="value02"                               type="value"/>
         <element name="value03"                          type="value"/>
         <element name="value04" type="class">
              <content>
                   <element-ref name="value04a" />
                   <element-ref name="value04b" />
              </content>
         </element>
         <element name="value05" type="class">
              <content>
                   <element-ref name="value05a" />
                   <element-ref name="value05b" />
              </content>
         </element>
         <element name="value06" type="class">
              <content>
                   <element-ref name="value06a" />
              </content>
         </element>
         <element name="value07" type="class">
              <content>
                   <element-ref name="value07a" />
              </content>
         </element>
         <element name="value08" type="class">
              <content>
                   <element-ref name="value08a" />
              </content>
         </element>
         <element name="value09" type="class">
              <content>
                   <element-ref name="value09a" />
              </content>
         </element>
         <element name="value10" type="class">
              <content>
                   <element-ref name="value10a" />
              </content>
         </element>
         <element name="value11" type="class">
              <content>
                   <element-ref name="value11a" />
              </content>
         </element>
         <element name="value12" type="class">
              <content>
                   <element-ref name="value12a" />
              </content>
         </element>
         <element name="value13" type="class">
              <content>
                   <element-ref name="value13a" />
              </content>
         </element>
         <element name="value14" type="class">
              <content>
                   <element-ref name="value14a" />
              </content>
         </element>
         <element name="value15" type="class">
              <content>
                   <element-ref name="value15a" />
              </content>
         </element>
         <element name="value16" type="class">
              <content>
                   <element-ref name="value16a" />
              </content>
         </element>
         <element name="value17" type="class">
              <content>
                   <element-ref name="value17a" />
              </content>
         </element>
         <element name="value18" type="class">
              <content>
                   <element-ref name="value18a" />
              </content>
         </element>
    </xml-java-binding-schema>
    * * * generated sourcecode for ELEMENT "value07"...i.e., "value07.java" * * *
    package testSourceCode;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.bind.ConversionException;
    import javax.xml.bind.Dispatcher;
    import javax.xml.bind.Element;
    import javax.xml.bind.InvalidAttributeException;
    import javax.xml.bind.InvalidContentObjectException;
    import javax.xml.bind.LocalValidationException;
    import javax.xml.bind.MarshallableObject;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.MissingContentException;
    import javax.xml.bind.PredicatedLists;
    import javax.xml.bind.PredicatedLists.Predicate;
    import javax.xml.bind.StructureValidationException;
    import javax.xml.bind.UnmarshalException;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.bind.Validator;
    import javax.xml.marshal.XMLScanner;
    import javax.xml.marshal.XMLWriter;
    public class Value07
    extends MarshallableObject
    implements Element
    private List _Value07A = PredicatedLists.createInvalidating(this, new Value07APredicate(), new ArrayList());
    private PredicatedLists.Predicate pred_Value07A = new Value07APredicate();
    public List getValue07A() {
    return _Value07A;
    public void deleteValue07A() {
    _Value07A = null;
    invalidate();
    public void emptyValue07A() {
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, new ArrayList());
    public void validateThis()
    throws LocalValidationException
    if (_Value07A == null) {
    throw new MissingContentException("value07a");
    public void validate(Validator v)
    throws StructureValidationException
    public void marshal(Marshaller m)
    throws IOException
    XMLWriter w = m.writer();
    w.start("value07");
    for (Iterator i = _Value07A.iterator(); i.hasNext(); ) {
    w.leaf("value07a", ((String) i.next()).toString());
    w.end("value07");
    public void unmarshal(Unmarshaller u)
    throws UnmarshalException
    XMLScanner xs = u.scanner();
    Validator v = u.validator();
    xs.takeStart("value07");
    while (xs.atAttribute()) {
    String an = xs.takeAttributeName();
    throw new InvalidAttributeException(an);
    List l = new ArrayList();
    while (xs.atStart()) {
    if (xs.atStart("value07a")) {
    xs.takeStart("value07a");
    String s;
    if (xs.atChars(XMLScanner.WS_COLLAPSE)) {
    s = xs.takeChars(XMLScanner.WS_COLLAPSE);
    } else {
    s = "";
    String uf;
    try {
    uf = String.valueOf(s);
    } catch (Exception x) {
    throw new ConversionException("value07a", x);
    l.add(uf);
    xs.takeEnd("value07a");
    } else {
    break;
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, l);
    xs.takeEnd("value07");
    public static Value07 unmarshal(InputStream in)
    throws UnmarshalException
    return unmarshal(XMLScanner.open(in));
    public static Value07 unmarshal(XMLScanner xs)
    throws UnmarshalException
    return unmarshal(xs, newDispatcher());
    public static Value07 unmarshal(XMLScanner xs, Dispatcher d)
    throws UnmarshalException
    return ((Value07) d.unmarshal(xs, (Value07 .class)));
    public boolean equals(Object ob) {
    if (this == ob) {
    return true;
    if (!(ob instanceof Value07)) {
    return false;
    Value07 tob = ((Value07) ob);
    if (_Value07A!= null) {
    if (tob._Value07A == null) {
    return false;
    if (!_Value07A.equals(tob._Value07A)) {
    return false;
    } else {
    if (tob._Value07A!= null) {
    return false;
    return true;
    public int hashCode() {
    int h = 0;
    h = ((127 *h)+((_Value07A!= null)?_Value07A.hashCode(): 0));
    return h;
    public String toString() {
    StringBuffer sb = new StringBuffer("<<value07");
    if (_Value07A!= null) {
    sb.append(" value07a=");
    sb.append(_Value07A.toString());
    sb.append(">>");
    return sb.toString();
    public static Dispatcher newDispatcher() {
    return Request.newDispatcher();
    private static class Value07APredicate
    implements PredicatedLists.Predicate
    public void check(Object ob) {
    if (!(ob instanceof String)) {
    throw new InvalidContentObjectException(ob, (String.class));

    I discovered something similar this morning...i.e., for
    <element name="value07" type="class">
    <content>
    <element-ref name="value07a" />
    </content>
    </element>
    -- I did something like this...
    Value7 v7 = new Value7();
    for (int i=0; i< Value7_input_array.length; i++)
    ((List)(v7.getValue07A())).add(Value7_input_array);
    Thanks for responding, barry!

  • Why it cannot find the setter method for the attribute in my custom tag?

    Hi, i have a custom tag like this:
    <robin:category tModelKey="#{data.tModelKey}" > </robin:category>And in my tld file:
    <tag>
          <name>category</name>
         <tag-class>category.component.HtmlCategoryTag</tag-class>
         <attribute>
             <name>tModelKey</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
             <type>java.lang.String</type>
         </attribute>
    </tag>
    ........................................and in my HtmlCategoryTag Class
    public class HtmlCategoryTag extends HtmlPanelGridTag
    private String tModelKey;
    public String getTModelKey()
    return tModelKey;
    public void setTModelKey(String modelKey)
    tModelKey = modelKey;
    So,you see,generally speaking,to use a custom tag,we only to write a tag class,declare it in the tld file,nothing more.
    What fints me is that if i change "tModelKey" to "test" and change the according part in the tag class , tld file and jsp file, the "setter not found" problem no longer exists,everything goes right!!!.
    So why this happens? please help:)
    Best Regards:)
    Robin

    Then you also need to create a UI element that extends HtmlPanelGrid
    that has a tModelKey member and getters/setters. That object will hold
    the information so that you can use it in your bean.Whoops... ignore that! Sorry. Attributes are simply stored in the component map component.getAttributes().
    Add to your Tag class:
    public void setProperties(UIComponent component) {
        super.setProperties(component);
        Tags.setString(component, "tModelKey", tModelKey);
    public void release() {
        // see above
    }Where Tags.java is:public class Tags {
        public static void setString(UIComponent component, String attributeName, String attributeValue) {
            if (attributeValue != null) {
                if (UIComponentTag.isValueReference(attributeValue)) {
                    setValueBinding(component, attributeName, attributeValue);
                } else {
                    component.getAttributes().put(attributeName, attributeValue);
        public static void setValueBinding(UIComponent component, String attributeName, String attributeValue) {
            FacesContext context = FacesContext.getCurrentInstance();
            Application app = context.getApplication();
            ValueBinding vb = app.createValueBinding(attributeValue);
            component.setValueBinding(attributeName, vb);
    }

  • How can i invoke the set method before value change listener?

    Hi,
    My code is like this:
    <af:selectManyCheckbox value="#{bean.statusList}"
                                     binding="#{bean.statusCheckBox}"
                                     label=" " autoSumit="true"
                                     valueChangeListener="#{bean.changeStatusList}"
                                     id="dc_smc1" layout="vertical"">
                <f:selectItems value="#{bean.statusBuckets}"
                               id="statusBuckets"/>
              </af:selectManyCheckbox>
    public void changeStatusList(ValueChangeEvent valueChangeEvent)
      //in this method, i want to set the statusList by myself, this is not the same with the ui.
    public void setStatusList(List<String> statusList)
            this.statusList = statusList;
        public List<String> getStatusList()
            return statusList;
    As i set the autoSumit="true", then no matter what i set the statusList in the method changeStatusList, it will be reset the value after invoke the method setStatusList, Therefore, it will always change the checkbox status through ui operation, i cannot change it through code.
    Pl help me!
    Thanks,
    Emma

    Emma, which jdev version do you use?
    As you have set the value property to the list you try to change in the valueChangeListener method this is expected behavior. If the list is bound to the af:selectManyCheckbox values you can't change it with a set method.
    It would help if you tell us what you are trying to do in a broader scope.
    Timo

  • Setter method not getitng called in the custom tag

    Hi,
    I have written a custom tag and I have declared an attribute in the tld file and have specified the setter method for the same in the java tag file but that setter method is not getting called...for rest of the attributes, the methods are getting called and not just for one!! any idea what could be the problem....
    Regards
    Deepak Saini

    Do you have a getter method to match that property?
    Post some example code - what does your tld define for this property, and what get/set methods have you defined for it?

  • Initialize in the constructor is better or set the value thro' set method?

    Hi,
    For the normal helper classes for servelt or jsp or EJB,
    Which of the following one is the better ...?
    1.
    i.initialize all the fields in the constructor, then
    ii.use the set methods
    or
    2.
    i.do not use the contructor and
    ii.use the set methods to set the values
    Anybody can give the solution for this one...
    With regards
    vkm

    Your option 1 puzzles me, why would you need tyo use the setter methods if you already initialized in the constructor?

  • Reflection and the field.set method

    OK, I've made 2 classes, a ClearParent and ClearChild (which extends ClearParent). I'd like to have a "clear" method on the parent which dynamically sets all the fields to null. I'd like to be able to have any child that inherits from the parent be able to call clear and dynamically have all it's fields set to null.
    Part of the restriction that I'm facing is that the fields are Objects (Integer) but the getter and setter methods take and return types (int). So I can't just loop through the Methods and call the setters with null.
    I'd like to be able to loop through the fields and call set for all the fields with the parent class.
    I'm inserting the code that I have for the parent and child classes at the end. Basically, the problem that I'm seeing is that if I do a
    this.getClass().getName()
    from the parent (when clear is called from the child) it shows me the child name ("ClearChild"). But when I try to do the
    field.set(this, null)
    it tells me this:
    Class ClearParent can not access a member of class
    ClearChild with modifiers "private"
    How come when I get the name it tells me that it's the child but when I pass "this" to the set method, it says that it's the parent?
    Any one know what's going on here? Is there anyway that I can have the parent set all the fields to null?
    Thanks in advance.
    Here's the code:
    ClearParent
    import java.lang.reflect.*;
    public class ClearParent {
        public boolean clear() {
            try {
                System.out.println(this.getClass().getName());
                Field[] fields = this.getClass().getDeclaredFields();
                Field   field;
                for (int i = 0; i < fields.length; i++) {
                    field = fields;
    field.set(this, null);
    } catch (Exception e) {
    e.printStackTrace();
    return true;
    ClearChild
    public class ClearChild extends ClearParent {
    private Float f;
    public ClearChild() {
    super();
    public float getF() {
    if (f == null) {
    return 0;
    return f.floatValue();
    public void setF(float f) {
    this.f = new Float(f);
    public static void main (String[] args) throws Exception {
    ClearChild cc = new ClearChild();
    cc.setF(23);
    cc.clear();
    System.out.println("cc.getF: " + cc.getF());

    It is an instance of ClearChild that is being used so
    that class name is ClearChild. However, the method
    exists in the parent class and thus cannot act upon a
    private field of another class (even if it happens to
    be a subclass).Ahh...makes sense.
    Why don't you just override clear in the child?We were trying to avoid this because we run into problems in the past of people adding fields to the class, but not adding to the clear, and things not being cleared properly.
    I talked it over with the guys here and they have no problem making the fields protected instead of private. If it's protected, then the parent has access to it and my sample code works.
    Thanks for your help KPSeal!
    Jes

  • Set Methods are not running

    I am writing my first jsp. I have a bean that I am wanting to use and my understanding is that if I put the following commands in, that all the set methods for my properties will run in the bean automatically as long as the names of the properties are the same as those on the form.
    <jsp:useBean id="MedicalBean" class="Project5.MedicalReimbursementRecord" scope="session"/>
    <jsp:setProperty name="MedicalBean" property="*"/>
    The form has a number of textboxes, each text box has a name of one of the properties in my bean. I put display in my bean and I know that it is never running any of the "set" methods for any of the properties. I know that it is indeed getting into my bean, as I have displayed which indicate that methods that I request are indeed running.
    I have not "ACTION" parameter on the FORM, but I have looked at the examples in Tomcat and they have forms which do not have an "Action". I don't think this is a problem, but maybe I am wrong about that. If I put in the statement of:
    <jsp:setProperty name="MedicalBean" property="GrpAcctNbr"/>
    Then I get the error "Cannot find any information on property 'GrpAcctMbr' in a bean of type 'Project5.MedicalReimbursementRecord'"
    So there must be something wrong with my setProperty statement, but what is it?
    Thanks in advance for your assistance.

    Can you show the relevant JSP code and set/get methods in the bean?
    Sometimes this error is caused by capitalization. e.g. a request param of "myName" calls setMyName(). Also, your bean must have a no arguments constructor.
    Also, if you don't specify an action,the form submits to the current URL so you should be ok. Are you sure that the JSP runs when the user submits the form?

  • How to call setter Method of ActionScript class with in a Flex Application

    Hi
    I have Action class as shown :
    public class MyClass
    private var name:String 
    public function get name():String {
        return _initialCount;
    public function set name(name:String):void {
        name = name;
    Now please let me know how can i access this Action class under my Flex Application and call the setter Method of it to set the value for the name .
    For example on entering some data in a TextInput and  click of a submit Button , on to the Event Listener , i want to call the set name method of my ActionScript class .
    Please share your ideas on this .

    Thanks  Gordon for your resonse .
    Say for example my Action class is like this :
    public class MyClass
    private var name:String 
    public function get name():String {
        return name;
    public function set name(name:String):void {
        name = name;
    This is inside the MXML
    I know this way we can do it
    public var myclass:MyClass = new MyClass();
    myclass.name="Kiran";
    Now my query is can we do in this way also ??
    myclass.set name(SomeTextInput.text);
    Please share your views on this , waiting for your replies .
    Thanks in advance .

  • Passing params to the AMImp method from backing bean

    Hello. I am an ADF/Jdeveloper Noob and i have a requirement where I have created an AM method below and exposed it to my View Controller.
    I am using Jdeveloper 11..1.1.4 to doe this.
    //In AM
    public boolean createSRTask(String sourceName, Number sourceRow)
    //insert new row in the Entity Object.
    EntityDefImpl SRTaskDef = MassSrImportEOImpl.getDefinitionObject();
    MassSrImportEOImpl newSRTask = (MassSrImportEOImpl)SRTaskDef.createInstance2(getDBTransaction(), null);
    newSRTask.setSourceName(sourceName);
    newSRTask.setSourceRow(sourceRow);
    return(true);
    I have a text file i am reading and I get the parameters from processing that file when the user presses the upload button... I can loop thru the file contents etc. with no issues but i have yet
    to figure out how to code the backing bean to call the AMImp method with the parameters I have read in.
    Thank you in advance for any help.
    Edited by: 832187 on Jan 16, 2012 6:51 AM
    Edited by: 832187 on Jan 16, 2012 7:01 AM

    In this case you should build a VO which is build on EO, add it to the data model of the application module. The you can either implement the service method in the VO or the application module. Let's assume you put it in the am (application module) like you already did. the method there would look like
    //In AM
        public boolean createSRTask(String sourceName, Number sourceRow) {
            ViewObjectImpl massView = (ViewObjectImpl)findViewObject("MassSrImportView1");
            Row row =  massView.createRow();
            row.setAttribute("Source", sourceName);
            row.setAttribute("SRCNR", sourceRow);
            massView.insertRow(row);
            return true;
        }Some note on this:
    1. the rows are not inserted in the db as long as you don't commit the transaction
    2. It look like your view does not have a PK. The framework works better if you have one
    3. If you always return true, you can omit the return value totally
    4. If you plan to insert multiple rows you should consider passing hte file to the am method and do a bulk insert in there as this would minimize round trips.
    I strongly recommend the you read the http://docs.oracle.com/cd/E25054_01/web.1111/b31974/bcintro.htm to get more knowledge about the business layer.
    Timo

  • Set methods or typecasting objects with JAXB

    Hi everybody,
    I am working on an example with the JAXB, which in many ways is an extraordinary technology, but I have quite a problem.
    I have compiled my schema with xjc - no problem, but i am missing to setMethods both of which is regarding a List. I've got
    java.util.List getSparepart() and java.util.List getCategory() but am missing the two set methods and I don't understand why.
    I have tried to solve the problem by defining the methods myself, which is allright right until the point where I use the methods.
    Here is a snip of the code:
    spTest.jaxb.CatalogType.VendorType vNowTemp = (spTest.jaxb.CatalogType.VendorType) objFactory.createCatalogTypeVendorType();
    vNowTemp = vNow;
    vNowTemp.setSparePartCategory(categoryResult);
    vNowTemp = vNow;
    result.add(vNowTemp);
    The problem is that there seems to be no difference between vNow or vNowTemp at any point, which there should be.
    I have tried to convert the java.util.List I get when I use getSparePart to a com.sun.xml.bind.util.ListImpl (which is the object type used within the classes JAXB's xjc produced) but this seems to be impossible.
    Could any one help me on this one please
    /Sebastian
    [email protected]

    Hi everybody,
    I am working on an example with the JAXB, which in
    many ways is an extraordinary technology, but I have
    quite a problem.
    I have compiled my schema with xjc - no problem, but i
    am missing to setMethods both of which is regarding a
    List. I've got
    java.util.List getSparepart() and java.util.List
    getCategory() but am missing the two set methods and I
    don't understand why.You don't need the SET methods for that. You can get to the list via the GET methods and then add/remove elements to/from it or empty/clear it. If you want to set an entirely different list, you could always use-
    getSparePart().clear();
    getSparePart().addAll(myNewList);
    Hope this helps.

  • Multiple setter methods

    Hi i have a jsp page that sets the value of a bean which has two setter methods for the same property but with different signatures the jsp code is
    <jsp:useBean id="version" scope="session" class="data.PeriodVersion"/>
    <jsp:setProperty name="version" property="version"/>
    <jsp:useBean id="dbSelector"  scope="session" class="configuration.DatabaseSelector"/>
    <jsp:setProperty name="dbSelector" property="version" value="<%= version %>"/>the java code is
        public void setVersion(int version){
            this.version = new PeriodVersion(version);
        public void setVersion (PeriodVersion version){
            this.version = version;
        }when run using tomcat this code gives an "argument mismatch" error
    however when i remove one of the setter methods it works
    does this mean that beans should only have one setter method. this seems very inflexible. or i am doing something wrong
    thx in advance

    Well, I guess I could have explained this upfront and saved a few people some headaches, but I was more concerned with why the code didn't work. Mostly, because I wasn't sure if I was going to implement that kind of system.
    Basically, it's a game using cards (not standard cards) and each one does a specific action. Really though, it's just increasing and decreasing values and setting flags. So, certain cards set flags that prevent you from doing anything until you play another specific card which counters that action and resets that boolean value, allowing you to continue on your merry way. There are specific cards that set specific flags and other cards that counter those. However (and this is the part that has me troubled), there is a card that can counter any of those previous actions and reset any flag back to false.
    I am not sure, other than an if or case statement how to implement this behavior. Once you play it, the human can choose which target to counter (flag to reset), and I am unsure of how to make a method that accepts the user's choice and carry on that action on the required variable. I mean, I do, and it wouldn't be the worst thing in the world to use an if-else if statement since there's only about 4 or 5 choices. I am just still learning and not totally content to one way of doing things.
    I don't care if I need to make them private with their own get and set methods, or if I just need to make them public and have the methods alter them directly. It's the one wildcard option that gets me confused.
    And, by best, I just meant I was looking for alternatives, and that I'll find out that will suit my needs best.
    I think, from now on, I should just explain what I'm trying to do in the first place, but I like to first test everything by taking code snippets and creating sub-experiments on the side to see if I can figure it out myself first.
    Edited by: mhoribe on Apr 27, 2009 3:44 PM

  • How to call a set method from within a constructor

    Hello,
    I want to be able to call a set method from within a Scanner, to be used as the argument to pass to the Scanner (from a source file). Here's what i tried:
    private void openFiles()
            input = new Scanner( setSource );              
        and here is the set method:
    public String setSource( String in )
            source = in;
            return source;
        }obviously there will be more code in this method but i'm trying to tackle one problem at a time. Thanks in advance..

    The "String in" declaration says: "Nobody may ever invoke setSource() without specifying a certain String. The content of the String is known at run-time only."
    In no place in your code you say the compiler: "I want the 'in' variable (actually, parameter) of method setSource() to contain the first arg which is passed to the application".
    This is exactly the same mechanism allowing you to write "new Scanner" with something inside the two parentheses.

Maybe you are looking for

  • How do I install LION on a separate HD and keep Mtn. Lion on Macbook.

    I am having problems with Mountain Lion and need help with installing and using LION on a separate hard drive. Please help.

  • Macbook Pro runs slow after upgrade

    I have just upgraded to Mountain Lion 10.8.3 (from 10.6.8) on my 2011 i7 Macbook Pro. My computer now runs slower than ever. Boot up takes forever. Shut down takes for ever. I get constant beach ball. I am shocked at how horrible this OS is and thoug

  • Sharepoint 2013 - OWA sometimes doesn't open the review frame

    Hello, I have an issue with the feature review file of Office Web Apps, this is an sometimes issue because sometimes it's able to open the review frame to review the PDF file but sometimes it doesn't as below Could anyone help me on this issue? thank

  • Colour profiling

    is it possible to use colour profiling on Elements 10?  if so, how.

  • How to find the Infoobject name by Datasource .

    Hi SAP Gurus Can any of you guys suggest how to find the list of Info objects for the Datasources . I have a scenario where I have a list of Datasources (400) which are Text and Attr Datasources, for which I need find the list Info objects, so can yo