h:selectOneMenu and "value" attribute

I have an issue with the <h:selectOneMenu> tag. On a page I've written, the select items are populated with a <f:selectItems> tag that is bound to a managed bean property with session scope which queries from a database table for the select items. The <h:selectOneMenu> value property - which determines the item that is selected - is bound to a property of a managed bean that has session scope.
There is a button on the screen that causes navigation to a new screen. On this screen, the user can add an entry to the database table from which the <f:selectItems> are populated. The event handler for the second screen adds a new item to the database table and sets the property on the managed bean to that determines which item is selected on the previous screen to this new value.
The problem I have is that the new item is added to the list, but it is not the selected item when the first screen is navigated back to. If I view the HTML code generated, none of the <option> tags contains the "SELECTED" property. Strangely, if I enter a new item that is less - alphabetically - than the existing items, it will be selected, but if I add an item that falls into the middle of the list or the end of the list alphabetically, it is not selected.
I don't know what to do here. Is there some requirement about sorting the collection that backs the <f:selecteditems> facet? This doesn't seem likely since I've tried various sorts to figure this out and nothing has worked. Is there a known bug setting the value property of <h:selectOneMenu>?
Any ideas?

When your setting the value for the <h:selectOneMenu> make sure its a string!
Here is a simple example
(.jsp page)
<h:selectOneMenu id="locationID" value="2">
   <f:selectItems value="#{LocationList.itemList}"/>
</h:selectOneMenu>
(HTML Code that gets generated from the .jsp page
<select id="edit:locationID" name="edit:locationID" size="1">
   <option value="1">Anoka</option>
   <option value="2"  selected>MSO</option>
</select>

Similar Messages

  • Picklist -- display and value attribute

    Is there a way to get and store both display and value attributes from the picklist? I would like to store the display attribute and the value attribute of the selected item from the picklist. It seems like it only returns one attribute. Thanks!

    Get an instance of messagechoice...
    there are two methods.
    setListValueAttribute("ViewAttributeName");
    setListDisplayAttribute("ViewAttributeName");
    you can get both values...
    Anoop

  • Difference between value attribute and value attribute under Node in contex

    I have very basic question..it might be very simple but it is giving me a problem.
    I have created one Node name "Input" and value attribute "Input1" under it.
    I have just created one more value attribute named "in1" not under any Node.
    I have created two input filed in the my view.One first I have mapped the value in properties
    to variables "Input.Input1" and on another "in1".
    When I deploy and run the application one Input box is coming as readonly and other is working fine .Will anybody tell me why it is so?

    There is no major difference between value attribute and inside a node.
    It is a separation of attributes. Usually all the attributes belongs to same purpose will create in one value node. Like, calling one BAPI - requestListBAPI - it contains all the bapi related value attributes.
    For your question, one field is read only(Input.Input1), bcz that context is not created. see the context properties.....cardinality will be 0..n. Change the cardinality to 1...n (<b>or</b>) create that context element .
    In your implementation create that value node like this in your init method.
    wdContext.createInputElement();
    It will solve your problem.
    in1 - is a value attribute, which is mapped to your input element. It wont have any problem.
    Regards,
    Sri

  • Difference between using Binding and Value Attribute

    what is the deference between using binding and value attribute, when I use binding attribute at the time of Value change listener is behaving like action listener,
    Ex:
    If I use value attribute, at the time of value change listener the component is not showing the result in the component but when I use Binding attribute it is happening automatically. So I want to know how the binding attribute is working.
    I know, at the time of binding attribute the component is creating an instance at the bean side, So even also how it is following the life cycle of the JSF Frame work, and also Please suggest me weather which one is better to use either Binding or Value?

    JNaveen wrote:
    If I use value attribute, at the time of value change listener the component is not showing the result in the component but when I use Binding attribute it is happening automatically. So I want to know how the binding attribute is working.You need to learn about the JSF lifecycle. The ValueChangeEvent is invoked after conversion and validation in the 3rd phase, while the model values are updated in the 4th phase. In the valueChangeListener method you normally use ValueChangeEvent#getNewValue() to get the new value after the change.
    I know, at the time of binding attribute the component is creating an instance at the bean side, So even also how it is following the life cycle of the JSF Frame work, and also Please suggest me weather which one is better to use either Binding or Value?Use the 'value' attribute to bind the value to the bean. Use the 'binding' attribute to bind the component to the bean. If you don't need to precreate the component or do other things than getting/setting its value, then there is no need for the 'binding' attribute.
    Read on those links if you want to know something more about the JSF lifecycle:
    [http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html].
    [http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] (pick 1st download).

  • OutputText : why both bind and value attribute and other gripes

    Hi
    gripe1
    I have started using creator and I'm a bit confused as to why creator insists on the binding attribute being in place to link the outputText field to the default managed bean -
    like most of us I want to set the value via a resource bundle. ( as shown blelow). If I delete the binding atttribute then outputText Field doesn't get displayed in the Visual Design tab. aaaaaaah!
    <h:outputText binding="#{DemographicInformation.nameLabel}" id="nameLabel" value="#{bundle.userName_label}"/>
    gripe2
    When you declare a resource bundle; either through editing the source directly or dragging from the advanced palette you can't seem to be able place the contained "names" in this the individual outputText field values via value property->bind to object->select from property file. i.e you do don't see to be able to expand the f: loadBundle. This results in a lot of tedious typing
    which I thought this tool was all about preventing!
    Regards
    Daniel

    Re gripe 1:
    Why do you want to remove the binding attribute? The binding attribute has nothing to do with the value - you can certainly display values from resource files without removing the binding attribute. One of the online tutorials (the Sign On example) shows a Creator project using bundle files.
    Re gripe 2:
    The designtime experience for using bundle files in the web app has been improved in the next version of Creator.
    -- Tor
    http://blogs.sun.com/tor

  • Value attribute not visible in runtime collection

    Hi,
    I have created some 2-3 value attributes (display only) in a standard model node for BTDOCFLOW (which also contains some display only fields). Put in the logic in their Getter methods and fields are getting displayed in UI with the values.
    Now, my requirement is to display this table view (Assignment block) in default sorting based upon one value attribute and one model node attribute. But the problem here is, I am unable to find value node attribute at runtime in BTDOCFLOW collection at DO_PREPARE_OUTPUT. (Even display only standard context node attributes, which are not part of model node structure are not visible)
    I have re-defined method GET_TABLE_LINE_SAMPLE with the value attributes, resulting in enhanced rv_sample line, but still the value attribute is not visible at runtime in the collection.
    Can someone pl. tell me, how can I display my value attributes in collection along with model node attributes, so that I can do default sorting based upon one custom and one model node attribute.
    Thanks,

    Hi,
    Whne you define value attributes within the model attribute then the node becomes mixed instead of either value node or model node.
    So you need to access the mixed node and then should access model attributes and value attributes separately.
    Get your collection into a normal entity then assign the entity to mixed node
    DATA: lr_mixed TYPE REF TO cl_bsp_wd_mixed_node ,
                current TYPE REF TO if_bol_bo_property_access,
                 lr_current TYPE REF TO cl_crm_bol_entity.
         current ?= me->typed_context->entity name->collection_wrapper->get_current( ).
          lr_mixed ?= current..
          lr_current ?= lr_mixed->if_bsp_wd_ext_property_access~get_model_node( ).
    Best Regards,
    Dharmakasi.

  • Difference between binding and value

    Hi
    I am new to JSF
    Can you tell me what is the difference between binding and value attribute of a
    JSF component ?
    Many thanks.

    Hi,
    the binding is the component association to a managed bean (or backing bean). This allows you to manipulate the component in Java code stored in a managed bean.
    The value is what the actual component value is.
    Frank

  • How to get the name and value of an attribute on a node/element that is not a child

    Hello,
    Can someone shed some wisdom on how I can compare 2 xml nodes for differences.
    My main challenge is I need to use the attributes/values of 'ProductDescription' and 'Features' as 'key' to identify the same node in
    another doc with the same layout, but different content.
    I am having trouble getting the name of the attribute on the node, 'ProductDescription' and 'Features'.  I can only seem to get the node names, but not the attributes on the node.  I need the name, because it can be different from doc to doc, so
    I can't hardcode this.
    Can someone please help with how to retrieve an attribute name/value on a node that is not a child.  Here's an example of what
    my xml looks like:
    DECLARE
    @myDoc1 xml
    ,@mydoc2 xml
    DECLARE
    @ProdID int
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    SET @myDoc2 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>2 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <features featureID = "2" featureName = "wheel">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>
    I need to compare the attributes of 'ProductDescription' and 'Features' from @mydoc1 against @mydoc2 to see if they are the same based on those 2 nodes first.  If they are, then i want to show the difference in the child elements. 
    This will eventually be an outer join to give me the differences betw the 2 docs based on those key values (node attributes).
    I used node('//*') for the path, and value('local-name(../.)', 'varchar(50)') as element
    ,value('.[not(@xsi:nil = "true")]','VARCHAR(255)') AS new_value
    ...etc...
    but that only gives me the node names, and the child elements.  It does not give me back the attribute names and values from the node itself.
    Thanks in advance for your help.
    cee

    Are you looking for something like this:
    DECLARE @myDoc1 xml
    SET @myDoc1 ='<ProductDescription ProductID="1" ProductName="Road Bike">
    <Features  featureID  = "1" featureName = "body">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    <Features featureID = "2" featureName = "seat">
      <Warranty>1 year parts and labor</Warranty>
      <Maintenance>2 year parts and labor extended maintenance is available</Maintenance>
    </Features>
    </ProductDescription>'
    SELECT T.c.value('local-name(.)', 'nvarchar(50)') AS name,
           T.c.value('.', 'nvarchar(50)')  AS value
    FROM   @myDoc1.nodes('ProductDescription/@*') AS T(c)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Get the attributes NAME and VALUE from an XML

    I really love this forum :)
    I load an XML an populate a Tree, from which I start to drag
    items.
    the xml looks like this:
    <myTag attrName="attrValue"
    otherAttrName="otherAttrValue"/>
    var ds:DragSource = event.dragSource;
    var var1:String =(event.dragInitiator as
    Tree).value.@attrName;
    -> the var1 variable has now: "attrValue"
    my question is.. how can I get all the attributes' names? in
    this example: attrName and otherAttrName (suppose I don't know the
    structure of that xml node)
    what about attributes values?
    thank you!

    The snippet below takes an xml node(nodeCur), loops over the
    attributes list and builds an array that contains the attribute
    name and value for each attribute. It comes from a sample app that
    allows you to edit an xml file.
    Sorry that the forum will remove the formatting
    var aDPAttributes:Array = new Array();
    var xlAttributes:XMLList = nodeCur.@*;
    var attribute:Attribute;
    for ( var i:int = 0; i < xlAttributes.length(); i++) {
    aDPAttributes.push({name:xlAttributes [ i ]
    .name(),value:xlAttributes [ i ] });
    dgAttributes.dataProvider = aDPAttributes; //set the property
    sheet dataProvider
    Tracy

  • Help in retrieving the element attribute name and value..

    Hi have to retrieve the attribute name and value from the element.....
    requirement is like this
    <ws:GetRightNowProductViewByDivisionResponse xmlns:ws="http://ws.sage.co.uk/">
    <ws:GetRightNowProductViewByDivisionResult ProductID=" " RightNowProductView=""/>
    </ws:GetRightNowProductViewByDivisionResponse>
    i should get all the element attbutes names as attributes in above mentioned format ..using xquery...
    here is the respone ....
    <sage:sageRequestResponse xmlns:sage="http://www.sage.com">
    <env:EaiEnvelope xmlns:env="http://www.sage.com/Envelope">
    <env:Domain>string</env:Domain>
    <env:Service>RightNowBroker</env:Service>
    <env:UserId>string</env:UserId>
    <env:OperationName>GetRightNowProductViewByDivision</env:OperationName>
    <env:Payload>
    <ws:GetRightNowProductViewByDivisionResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.sage.co.uk/">
    <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="RightNowProductView" msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="RightNowProductView">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="ProductId" type="xs:short"/>
    <xs:element name="Product" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="4000"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
    <xs:selector xpath=".//RightNowProductView"/>
    <xs:field xpath="ProductId"/>
    </xs:unique>
    </xs:element>
    </xs:schema>
    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"/>
    </ws:GetRightNowProductViewByDivisionResult>
    </env:Payload>
    </env:EaiEnvelope>
    </sage:sageRequestResponse>

    Hi
    Just as an aside to the comments above, a scenario we see occasionally is where a desk provides an internal function (e.g. a helpdesk) and you really just want to get the name display (as seen on the handsets) onto the CAD display.
    You can do this by  doing a reverse lookup over HTTP against CUCM. There are a number of posts around, these should get you started :
    https://supportforums.cisco.com/thread/2065114
    https://supportforums.cisco.com/message/3024617
    A couple of notes:
    - It looks up against the directory, NOT the actual calling line. So you can add stuff to the directory to get external callers to show up by name, but should expect the unexpected when you have shared lines (e.g. multipel directory entries with one tel number for whatever reason)
    - If you want to do different lookups (i.e. get names back in a different format, get the actual line display name from CUCM, or lookup elsewhere) then you would need to either:
    1) Do it via SOAP or another technology from the UCCX script engine
    2) Put in a small external web service to do the lookups and allow UCCX to query via simple HTTP
    3) Use a DB for the numbers so you can read/write to it from UCCX and regularly update the data from wherever you like
    Regards
    Aaron HarrisonPrincipal Engineer at Logicalis UK
    Please rate helpful posts...

  • Need to add row and set attribute value on pageload

    Guys,
    On my page based on the pageflowscope variable value, i need to add a row for master and one row for detail viewobject and set attribute values. (Some of the attribute are LOV and Checkboxes as well)
    I am using following code to create records.....records are being added but i am not able to set the attributes
    OperationBinding ob;
    ob = ADFUtil.findOperationBinding("Create");
    ob.execute();
    ob = ADFUtil.findOperationBinding("CreateInsert3");
    ob.execute();
    I am using following code to set the attributes value
    DCIteratorBinding dc1 = ADFUtil.getBindingIterator("firstiterator");
    DCIteratorBinding dc = ADFUtil.getBindingIterator("seconditerator");
    row1=dc1.getCurrentRow();
    row=dc.getCurrentRow();
    row.setAttribute("activest","A");
    row1.setAttribute("type","dc14");
    Anything i am doing wrong here or any suggestion to try is greatly appreciated....

    Vinod,
    Yes commit button is there and yes its also has entry in pagedef...
    When I open the same page on edit mode and i can edit regular record and save them
    Problem is that when i open the page on new mode and try to add rows on page load..... and setting values as described above.... save button somehow doesn't work...
    seems like after i add the rows on the fly, i need to refresh the binding?
    any help is greatly appreciated....
    thank you guys

  • Remove XML attribute and value

    Hi All,
    I require to delete the attribute and value in xml structure.
    Below code is not working due to ":" (aid:cstyle) between attribute name.
    JS code is:
    evaluateXPathExpression("//typestyle[@aid:cstyle = 'bold']")
    If I remove colon and change it to aidcstyle than it is working. How to read : (colon)?
    Also it is showing alert message again and again.
    Please help.
    Chang.

    for the first problem there are two fixes:
    first one (simple, normal, no ideea why it's not there already) declare your aid (and aid5) namespaces in your xml. For example:
    <Root xmlns:aid=”http://ns.adobe.com/AdobeInDesign/4.0/”
    xmlns:aid5=”http://ns.adobe.com/AdobeInDesign/5.0/”>
    second one: more advanced xpath, if it works, using local_name() and namespace-uri(). My xpath-expert is not at work right now, so i can't help you more with this until he's back.
    second problem... no real fix for now. some characters that indesign uses (indentToHere and rightIndentTab, as far as I know, but may be others too) have no UTF equivalent, so you get that warning. you can eitehr ignore it, or, as I do, before doing anything with XML in scripting, i change the said characters to some marking (##RIT## and ##ITH##), and change them back after changing the XML

  • ActiveSync and multi-value attributes

    I'm a litte bit lost in trying to create an adapter and associated forms for populating an ldap directory with multi-valued attributes. What is the 'prescribed' process for dealing with attributes that could have 1 or more values?

    Did you ever get anything like this.
    when I try to deal with this in a user form, it can detect and display the mv attribute, and the User View clearly shows it as an array, but it seems that the system basically does a toString() on it as one I try to save back it collapses the mv attribute into one instance of comma separated values.
    Z

  • Difference between the binding and the value attribute of an Oracle ADF com

    Can somebody please tell me the difference between
    the binding attribute and the value attribute of any oracle ADF component such as inputText and when would we use one over the other.
    THanks,

    Value represent the value that is going to be displayed by the item.
    Binding indicate the backing bean object that represents the instance of the component.

  • What is mean?AND bar = cfqueryparam value="#attributes.bar#" /

    what is mean?
    AND bar = <cfqueryparam value="#attributes.bar#" />
    </cfquery>
    <cfset attributes.isFooBar = (foo.recordCount neq 0) />
    of
    <cfquery name="foo" datasource="#request.DSN#">
    SELECT
    id
    FROM
    foobar
    WHERE 1 = 1
    AND bar = <cfqueryparam value="#attributes.bar#" />
    </cfquery>
    <cfset attributes.isFooBar = (foo.recordCount neq 0)
    />

    Basically you have a query "foo". It is pulling "id" from the
    table "foobar" where an attribute was passed into the template.
    "attributes.bar"
    Then you are doing a true/false on the recordcount. If it is
    0 you get 0 otherwise you get 1.

Maybe you are looking for

  • Outstanding open sales order (To be Invoiced Amt.)

    Dear Experts, I need to display Outstanding open sales order items only with its balanced quantity to be invoiced and amount. I am calculating Open SO Line item Qty as Open Qty = Sales Order line item Qty(VBAK) - Invoiced line item Qty(VBRP). And I a

  • OSB Parallel Processing using OSB

    Hi All, I am working on a proxy service based on WSDL-A. Stage-1 I have to do a service callout (sc1) to another business service with a particular parameter. From the response of that sc1 i need to pick two variables var1 and var2 and use it the req

  • Static function

    Hi, can static function be overridden? and if yes, then is it a good practice to use it or we sould avoid this? Thanks sumit

  • How to match contents of iPad and library?

    I find that my iPad and hd library contents do not agree. When trying to sync am asked to delete my iPad library

  • Please Help!  Audio off on imported .mp4 files (but fine everywhere else).

    Hello, I am trying to trouble shoot a problem.  I am a beginner when it comes to the technical end of this so please forgive me if I don’t post the correct information.  Hopefully somebody here can help or point me in the right direction.  My problem