SelectOneListbox

Basically I need to add the contents of a list box from one bean to another bean
I am populating the selectOneListbox from a database table via a backing bean � this bit I have managed to do.
When I submit the form I want to add the contents of the selectOneListbox to another bean to be stored in a database (a foreign key)
Here is the code used to poulate the listbox from courseOffering bean.
addStudent.jsp
<h:outputText value="#{msgs.courseOffering}" />               
<h:selectOneListbox id="courseOffering" size="1" value="#{courseOffering.courseOfferings}">
<f:selectItems value="#{courseOffering.courseOfferingsItems}"/>
</h:selectOneListbox>
<h:message for="courseOffering" styleClass="errorMessage"/>
courseOfferingBean
public String getCourseOfferings() {
return courseOfferings;
public void setCourseOfferings(String newValue) {
courseOfferings = newValue;
protected Collection courseOfferingsItems = null;
public Collection getCourseOfferingsItems() throws SQLException, NamingException {
courseOfferingsItems = new ArrayList();
try {
open();
PreparedStatement st = conn.prepareStatement("SELECT courseOfferingCode from tblCourseOffering order by courseOfferingCode");
ResultSet rs = st.executeQuery();
while (rs.next()) {
courseOfferingsItems.add(new SelectItem(rs.getString(1)));
return courseOfferingsItems;
finally {
close();
public void setCourseOfferingsItems(Collection newOptions) {
courseOfferingsItems = new ArrayList(newOptions);
I what place the selected item into the studentBean then to add to the database here is my code so far.
studentBean
private String courseOfferings;
public String getCourseOfferings() {
return courseOfferings;
public void setCourseOfferings(String newValue) {
courseOfferings = newValue;
public String addStudent() throws SQLException, NamingException {
try {
open();
PreparedStatement idQuery = conn.prepareStatement(
"SELECT * from tblStudent WHERE studentNo = ?");
idQuery.setString(1, studentNo);
ResultSet res = idQuery.executeQuery();
boolean movenext = res.next();
if (!movenext) {
String addStatement = "INSERT INTO tblStudent VALUES (?, ?, ?, ?, ?, ?)";
PreparedStatement prepStmt = conn.prepareStatement(addStatement);
prepStmt.setString(1, studentNo);
prepStmt.setString(2, firstName);
prepStmt.setString(3, surname);
prepStmt.setDate(4, toSQLDate(date));
prepStmt.setInt(5, yearEnrolled);
prepStmt.setString(6, courseOfferings);
prepStmt.executeUpdate();
prepStmt.close();
return "findStudentSuccess";
else
return "idAlreadyExists";
finally {
close();
This allways returns 'null', I have been trying to get this working for 2 weeks now help please.

I have managed to solve this problem
Please ingnore this thread

Similar Messages

  • Adding items to a selectOneListbox from Javascript

    In my JSF page I have...
    <h:form id="alternateDeviceSelectForm">
        <h:selectOneListbox id="selectBox"/>
        <h:commandButton id="okButton" value="#{i18n.ok}" action="#{aBean.anActionMethod}"/>
    </h:form>I also have this Javascript...
    for (var i=0; i < devices.length; i++) {
        var device = devices;
    // a String
    var id = device.getId();
    // another String
    var displayName = device.getDisplayName();
    this.selectBox.options[i] = new Option(displayName,id);
    This creates the listbox and when the Javascript method fires, the appropriate items are listed in as list items.  However, when I hit the OK button, I get a JSF message about a validation error.  I'm not using any custom validation at all.
    Here's the error message I get... "alternateDeviceSelectForm:selectBox: Validation Error: Value is not valid"
    Any ideas on how I can get this working?  (I have to get the listbox item values from Javascript because that is the interface to a browser plugin that is involved in this process.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    dalearyous wrote:
    the only thing is there is no data to begin with. after you choose the data structure there is a text field to type in something like apple and then you click add. then you can type in something like pear and click add.If you do it right, the part that controls the data structures won't need to directly interact with the part that adds/removes the elements in the data structures -- they'll be independent units. That's what we call "orthogonal", and it helps make programs much easier to develop and maintain. To do that, you have a common set of add/remove operations across all data structures -- just like in the Collections framework, which you should use unless your teacher is telling you that you must make your own. (And even if you do, ask your teacher if you can use the interfaces from the Collections framework, if not the implementations.)
    The example I showed you supports that, in that it doesn't assume that the data structures initially contain any data. (Though it might be better to create empty Collections in your constructor, rather than ever letting existingCollection go null.

  • Can "h:selectOneListbox" be used for navigation?

    I have an application that will be made up of several .war files. Each .war file is an application in itself.
    In other words, this is still considered as one big application, but for development purposes, each "feature" of the one big application is an application and uses it's own .war. By doing this, any changes would allow me to role out the specific .war that was needed.
    Right now, I am planning out the navigation at this point.
    There will be a menu "h:selectOneListbox" at the top of each page throughout the one big application that will allow a user to go to a different application.
    What is the best approach in planning out the faces-config.xml files?
    For example, would I just define each as:
    <navigation-rule>
    <navigation-case>
    <from-outcome>appone</from-outcome>
    <to-view-id>/application_subdirectory_a/app1.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>apptwo</from-outcome>
    <to-view-id>/application_subdirectory_b/app2.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>appthree</from-outcome>
    <to-view-id>/application_subdirectory_c/app3.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>
    What is the right way to approach JSF navigation using a "h:selectOneListbox"?
    Can I even do this, since "h:selectOneListbox" doesn't have an action attribute?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    If you indeed need it - you can.
    For it you should create commandLink with action, you need, for example:
    <h:commandLink id="cmdLink1"  action="#{yourBean.beanMethod}" />and create javascript function:
         function executeCommandLink(idLink,formName){            document.forms[0].elements[formName+':_link_hidden_'].value=idLink;
                if(document.forms[formName].onsubmit){
                    document.forms[formName].onsubmit();
                document.forms[0].submit();
                return false;
                }And, put this js function into onclick method of your selectOneListBox:
    <h:selectOneListbox onclick="executeCommandLink('cmdLink1','YourFormName')" />It will work for myFaces implementation of jsf - for another you should change js function a little.

  • How to populate items in selectOneListBox from a string array

    Hi
    I have got a string array result[] .Now i wish to display the array items in selectOneListBox.Please help me?

    Alance wrote:
    Hi
    I have got a string array result[] .Now i wish to display the array items in selectOneListBox.Please help me?I can only guess what your selectOneListBox is but if it is JComboBox - have you ever thought about reading the API ?
    [http://java.sun.com/javase/6/docs/api/javax/swing/JComboBox.html]
    There's a wonderful constructor which probably does what you are looking for.

  • Problem with af:selectOneListbox

    I am having a problem that when my af:selectOneListbox has enough values to display the scroll bar it is truncating the values displayed - anyone able to fix this - i need to have it autosize the width. I have also tried to add  s to the end of my selectItems values but they just get escaped out whether i set the escape to true or false on the selectItem value.

    The problem is that I dont know how wide the contents are - it depends on what the users query returns - the af:selectOneListbox works fine with auto-sizing itself unless the list is long enough to require a scrollbar - then the auto-sizing does not account for that and the scrollbar covers the last 2 characters. - Setting the width would potentially cause it to be too wide in some situations unless i can calculate the number of max number of characters in the list and acurately translate that to a width.
    I have a feeling there might be something in the fusion stylesheet that might effect this and be able to fix it.
    Edited by: user8961442 on Oct 21, 2010 6:45 AM

  • Problem with h:selectOneListBox

    I ve got an arrayList
    private List tempData=new ArrayList();
    'tempData' contains a list of company names eg :-BAN~Bank of America,TCS~Tata Consultancy Services etc etc.Now my jsf page contains h:selectOneListBox
    <h:selectOneListBox id="cmpny" value="#{MyBean.selectedItem}">
    <f:selectItems value="#{MyBean.selectItems}/></h:selectOneListBox>
    How to show the list items in 'tempData' in the <h:selectOneListBox>?How can i link between List <SelectItem> and tempData?

    <h:selectOneListbox value="#{myBean.selectedCompany}">
        <f:selectItems value="#{myBean.selectCompanies}" />
    </h:selectOneListbox>
    private String selectedCompany; // +getter +setter
    private List<SelectItem> selectCompanies; // +getter
    public MyBean() {
        fillSelectCompanies();
    private void fillSelectCompanies() {
        selectCompanies = new ArrayList<SelectItem>();
        for (Company company : companyDAO.list()) {
            selectCompanies.add(new SelectItem(company.getValue(), company.getLabel()));
    }Or if you want to use actual Company objects as SelectItem value, then check this article: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html]. The selectOneListbox works (and renders when 'size' attribute is not set) exactly the same.
    Edited by: BalusC on 7-okt-2008 20:15 (typo)

  • Displaying Horizontal Scrollbar in h:SelectOneListbox

    I am using myfaces1.1.4.
    I have a popup which will search for branches based on selected countries.So basically it will show branch name and adress in a h:selectOneListbox.I have vertical scroll bar with this, but i am trying to generate the horizontal scroll bar which is not a default with this component, i think i need to customize that component.I tried to play around with style attribute.But it is not working.
    This is the following code i am using:
    <h:selectOneListbox value="#{backingBean.branchID}"
    id="branchResults" size="5" required="false"
    style="WIDTH: 510px; HEIGHT: 80px; FONT-FAMILY: Courier New;">
    <f:selectItems id="branchNames"
    value="#{backingBean.branchMatches}" />
    I appreciate if you can look in to this.
    Thanks.

    Horizontal scrollbars are not attached to a block but to a canvas.
    if you need some spreadtable requierement, add a stacked canvas to your content canvas, and set the CANVAS item property of these items to this canvas.
    If the size of the stacked canvas is smaller to fit every items (and it probably should), you will see a horizontal scrollbar displayed at runtime.
    Francois

  • Update rows in Database reading field in rows of selectoneListBox

    JDev 11.1.1.4, application JSF.
    I have a .jspx that contain a af:table with 20 rows. These rows are read from database.
    I have (in the same .jspx) a af:selectoneListBox with f:selectItems.
    I use drag and drop from table to selectoneListBox. I save into af:selectItems the first field of each row choice.
    Now, how can I put a button than when I press it, it makes a change in database (View Objects) passing as parameter the field reads in row of selectoneListBox.
    Thanks

    Thanks for your replay Kamaal,
    but I have thought another way.
    I'd like to write something like:
    update filea set field1='1' where field2 in (getSelectedItems())
    where getSelectedItems() contain the fields read in rows of selectoneListBox.
    But, I do not know where I have to write this sql statement and then how to execute it by pressing a button, maybe in the ViewObjectImpl ? and if yes, how?
    Thanks

  • How to show static values in h:selectOneListbox

    Hi
    i would like to show static values in <h:selectOneListbox>
    how do i that ??
    <managed-bean>
    <managed-bean-name>Options</managed-bean-name>
    <managed-bean-class>java.util.ArrayList</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <list-entries>
    <value>val1</value>
    <value>val2</value>
    <value>val3</value>
    </list-entries>
    </managed-bean>
    or some how i define a <managed-property> ??
    <managed-property>
    <property-name>options</property-name>
    <property-class>java.util.ArrayList</property-class>
    <list-entries>
    <value>val1</value>
    <value>val2</value>
    <value>val3</value>
    </list-entries>
    </managed-property>

    Hi Swetlin,
    I have this format in the main window.
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    now when i am doing as you suggested
    the last texts are coming in the next page.
    What i want is to show overflow of numeric data in next page and the remaining last text should remain as it is in the first page only.
    i mean
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    and in the next page
    4567
    4568
    8790
    Thanks and regards
    Mave

  • JSF 1.2 RI - selectOneListbox has duplicate size attribute

    When overiding the size attribute on selectOneListbox it results in 2 size attributes being rendered (SJAS 9.0 FCS + Facelets 1.1.13), normally this wouldn't be a problem but since I'm using Facelets the browser throws a validation exception on the generated XHTML.
    Using selectOneMenu works as a replacement though as it doesn't accept a size attribute.
    Anybody else experienced duplicate attributes?

    Hi Daniel,
    This was fixed in 1.2_01. You can download an updater [1] that will install the JSF 1.2_01 binaries into an existing SJSAS 9.0 server.
    The release notes [2] also cover an additional configuration step that is necessary in order for resource injection to work properly.
    [1] https://javaserverfaces.dev.java.net/files/documents/1866/37449/jsf-glassfish-updater-1.2_01-b04-FCS.jar
    [2] https://javaserverfaces.dev.java.net/nonav/rlnotes/1.2_01/index.html

  • Dependent SelectOneListBox in ADF 10g

    hi,
    can anyone tell me the steps for Dependent SelectOneListBox in ADF 10g and atleast give a sample code work out

    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces"
              xmlns:afh="http://xmlns.oracle.com/adf/faces/html"
              xmlns:afi="http://xmlns.oracle.com/adf/industrial/faces"
              xmlns:adfp="http://xmlns.oracle.com/adf/faces/portlet"
              xmlns:aj="http://java.sun.com/blueprints/ajaxtextfield">
      <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
                  doctype-system="http://www.w3.org/TR/html4/loose.dtd"
                  doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
      <jsp:directive.page contentType="text/html;charset=windows-1252"/>
      <f:view>
        <af:document title="Service Extensions">
          <af:form>
            <af:panelPage title="Create Service Request">
              <f:facet name="menu1"/>
              <f:facet name="menuGlobal"/>
              <f:facet name="branding"/>
              <f:facet name="brandingApp"/>
              <f:facet name="appCopyright"/>
              <f:facet name="appPrivacy"/>
              <f:facet name="appAbout"/>
              <af:panelForm maxColumns="2" rows="3" width="60%">
                <af:selectOneListbox value="#{bindings.SrVOPartyId.inputValue}"
                                     label="#{bindings.SrVOPartyId.label}"
                                     autoSubmit="true" id="PartyList">
                  <f:selectItems value="#{bindings.SrVOPartyId.items}"/>
                </af:selectOneListbox>
                <af:selectOneChoice value="#{bindings.SrVOCustAccountId.inputValue}"
                                    label="#{bindings.SrVOCustAccountId.label}"
                                    partialTriggers="PartyList">
                  <f:selectItems value="#{bindings.SrVOCustAccountId.items}"/>
                </af:selectOneChoice>
                <af:inputText value="#{bindings.PartyId.inputValue}"
                              label="#{bindings.PartyId.label}"
                              required="#{bindings.PartyId.mandatory}"
                              columns="#{bindings.PartyId.displayWidth}"
                              rendered="false">
                  <af:validator binding="#{bindings.PartyId.validator}"/>
                  <f:convertNumber groupingUsed="false"
                                   pattern="#{bindings.PartyId.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.CustAccountId.inputValue}"
                              label="#{bindings.CustAccountId.label}"
                              required="#{bindings.CustAccountId.mandatory}"
                              columns="#{bindings.CustAccountId.displayWidth}"
                              rendered="false">
                  <af:validator binding="#{bindings.CustAccountId.validator}"/>
                  <f:convertNumber groupingUsed="false"
                                   pattern="#{bindings.CustAccountId.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.Invtoryitemid.inputValue}"
                              label="#{bindings.Invtoryitemid.label}"
                              columns="#{bindings.Invtoryitemid.displayWidth}">
                  <af:validator binding="#{bindings.Invtoryitemid.validator}"/>
                  <f:convertNumber groupingUsed="false"
                                   pattern="#{bindings.Invtoryitemid.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.SerialNumber.inputValue}"
                              label="#{bindings.SerialNumber.label}"
                              required="#{bindings.SerialNumber.mandatory}"
                              columns="#{bindings.SerialNumber.displayWidth}">
                  <af:validator binding="#{bindings.SerialNumber.validator}"/>
                </af:inputText>
                <af:inputText value="#{bindings.Summary.inputValue}"
                              label="#{bindings.Summary.label}"
                              required="#{bindings.Summary.mandatory}"
                              columns="#{bindings.Summary.displayWidth}">
                  <af:validator binding="#{bindings.Summary.validator}"/>
                </af:inputText>
                <f:facet name="footer">
                  <af:panelGroup layout="vertical">
                    <af:objectSpacer width="10" height="20"/>
                    <af:panelButtonBar>
                      <af:commandButton actionListener="#{bindings.process.execute}"
                                        text="process"
                                        disabled="#{!bindings.process.enabled}"
                                        action="CreateSr"/>
                    </af:panelButtonBar>
                  </af:panelGroup>
                </f:facet>
              </af:panelForm>
            </af:panelPage>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    page Definition
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
                    version="10.1.3.42.70" id="CreateSrPageDef"
                    Package="userinteface.pageDefs"
                    MsgBundleClass="userinteface.pageDefs.CreateSrPageDefMsgBundle">
      <parameters/>
      <executables>
        <iterator id="SrVOIterator" RangeSize="10" Binds="SrVO"
                  DataControl="srAMDataControl"/>
        <invokeAction Binds="ExecuteWithParams" Refresh="renderModel"
                      id="InvokeActionExecuteWithParams"/>
        <invokeAction Binds="Create" id="invokeCreate" Refresh="renderModel"
                      RefreshCondition="${!adfFacesContext.postback and empty bindings.exceptionsList}"/>
        <iterator id="SerialnumbersIterator" Binds="Serialnumbers" RangeSize="-1"
                  DataControl="srAMDataControl"/>
        <variableIterator id="variables"/>
        <iterator id="CustomersIterator" RangeSize="-1" Binds="Customers"
                  DataControl="srAMDataControl"/>
        <invokeAction id="InvokeActionExecuteWithParams1" Binds="ExecuteWithParams1"
                      Refresh="renderModel"/>
        <iterator id="AccountsIterator" RangeSize="-1" Binds="Accounts"
                  DataControl="srAMDataControl"/>
      </executables>
      <bindings>
        <action id="Create" RequiresUpdateModel="true" Action="41"
                IterBinding="SrVOIterator" InstanceName="srAMDataControl.SrVO"
                DataControl="srAMDataControl"/>
        <action IterBinding="SerialnumbersIterator" id="ExecuteWithParams"
                InstanceName="srAMDataControl.Serialnumbers"
                DataControl="srAMDataControl" RequiresUpdateModel="true"
                Action="95">
          <NamedData NDName="itemid"
                     NDValue="${bindings.SrVOInvtoryitemid.inputValue}"
                     NDType="oracle.jbo.domain.Number"/>
        </action>
        <attributeValues id="PartyId" IterBinding="SrVOIterator">
          <AttrNames>
            <Item Value="PartyId"/>
          </AttrNames>
        </attributeValues>
        <attributeValues id="CustAccountId" IterBinding="SrVOIterator">
          <AttrNames>
            <Item Value="CustAccountId"/>
          </AttrNames>
        </attributeValues>
        <attributeValues id="Invtoryitemid" IterBinding="SrVOIterator">
          <AttrNames>
            <Item Value="Invtoryitemid"/>
          </AttrNames>
        </attributeValues>
        <attributeValues id="SerialNumber" IterBinding="SrVOIterator">
          <AttrNames>
            <Item Value="SerialNumber"/>
          </AttrNames>
        </attributeValues>
        <attributeValues id="Summary" IterBinding="SrVOIterator">
          <AttrNames>
            <Item Value="Summary"/>
          </AttrNames>
        </attributeValues>
        <methodAction id="process" InstanceName="CreateSRDC"
                      DataControl="CreateSRDC" MethodName="process"
                      RequiresUpdateModel="true" Action="999"
                      IsViewObjectMethod="false"
                      ReturnName="CreateSRDC.methodResults.CreateSRDC_process_result">
          <NamedData NDName="P_CREATESR_REC_CUST_ACCOUNT_ID"
                     NDValue="${bindings.PartyId}" NDType="java.math.BigDecimal"/>
          <NamedData NDName="P_CREATESR_REC_PARTY_ID"
                     NDValue="${bindings.CustAccountId}"
                     NDType="java.math.BigDecimal"/>
          <NamedData NDName="P_CREATESR_REC_SERIAL_NUMBER"
                     NDValue="${bindings.SerialNumber}" NDType="java.lang.String"/>
          <NamedData NDName="P_CREATESR_REC_INVENTORY_ITEM_ID"
                     NDValue="${bindings.Invtoryitemid}"
                     NDType="java.math.BigDecimal"/>
          <NamedData NDName="P_CREATESR_REC_SUMMARY" NDValue="${bindings.Summary}"
                     NDType="java.lang.String"/>
          <NamedData NDName="P_SR_NOTES_TBL_P_SR_NOTES_TBL_ITEM"
                     NDType="[Ljava.lang.Object;"/>
        </methodAction>
        <list id="SrVOPartyId" IterBinding="SrVOIterator" StaticList="false"
              ListOperMode="0" ListIter="CustomersIterator">
          <AttrNames>
            <Item Value="PartyId"/>
          </AttrNames>
          <ListAttrNames>
            <Item Value="PartyId"/>
          </ListAttrNames>
          <ListDisplayAttrNames>
            <Item Value="PartyName"/>
          </ListDisplayAttrNames>
        </list>
        <action IterBinding="AccountsIterator" id="ExecuteWithParams1"
                InstanceName="srAMDataControl.Accounts"
                DataControl="srAMDataControl" RequiresUpdateModel="true"
                Action="95">
          <NamedData NDName="pid" NDValue="${bindings.SrVOPartyId.inputValue}"
                     NDType="oracle.jbo.domain.Number"/>
        </action>
        <list id="SrVOCustAccountId" IterBinding="SrVOIterator" StaticList="false"
              ListOperMode="0" ListIter="AccountsIterator" NullValueFlag="1"
              NullValueId="SrVOCustAccountId_null">
          <AttrNames>
            <Item Value="CustAccountId"/>
          </AttrNames>
          <ListAttrNames>
            <Item Value="CustAccountId"/>
          </ListAttrNames>
          <ListDisplayAttrNames>
            <Item Value="AccountNumber"/>
          </ListDisplayAttrNames>
        </list>
      </bindings>
    </pageDefinition>if i select a value in selectoneListBox the SelectChoiceBox should populate according to values selected in the Selection can anyone please help me
    i have gone thru this link http://www.scribd.com/doc/2633296/ADF-Learning-6-Dependent-List-Boxes
    and followed the link
    Edited by: Naveenapps on Sep 12, 2009 5:09 AM

  • Events not fired using h:selectOneListbox with valueChangeListener

    I am trying to detect a change to the selection list. My webpage contains
    <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
        <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>
            <h:form id="myform">
              <h:inputText valueChangeListener="#{itemSource.itemChanged}" /><br/>
              <h:inputText valueChangeListener="#{itemSource.itemChanged}" /><br/>
              <h:selectOneListbox id="selection"
                                  valueChangeListener="#{itemSource.itemChanged}"
                                  value="#{itemSource.selectedItem}"
                                  size="4">
                <f:selectItems value="#{itemSource.items}"
                   var="item"
                   itemValue="#{item}"
                   itemLabel="#{item.name}"/>
              </h:selectOneListbox>
            </h:form>
        </h:body>
    </html>and my class looks like this
    package com.j2anywhere.demo;
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.Collection;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import javax.faces.event.FacesListener;
    import javax.faces.event.ValueChangeEvent;
    * @author alex
    @ManagedBean(name = "itemSource")
    @SessionScoped
    public class ItemSource implements Serializable, FacesListener
      private Collection<Item> items;
      private Item selectedItem;
      public ItemSource()
        items = new ArrayList<Item>();
        for (int index = 0; index < 5; index++)
          items.add(new Item("Item" + index, "Value" + index));
        selectedItem = items.iterator().next();
      public Collection<Item> getItems()
        return items;
      public void setItems(Collection<Item> items)
        this.items = items;
      public Item getSelectedItem()
        System.out.println("getSelectedItem "+selectedItem);
        return selectedItem;
      public void setSelectedItem(Item selectedItem)
        System.out.println("setSelectedItem "+selectedItem);
        this.selectedItem = selectedItem;
      public void itemChanged(ValueChangeEvent event)
        System.out.println("selectItem "+event.getNewValue());
        Object value = event.getNewValue();
        if (value instanceof Item){
          selectedItem = (Item)value;
        else {
          items.add(new Item(value.toString(), value.toString()));
    }However no matter what I do I am not seeing the event being generated in the log. I am using JSF 2.0.2.FCS and tested with both Glassfish3 and Tomcat 6.0.26. Any idea what I am missing.

    Any chance you have a small example of using AJAX ?
    I tried adding
          <h:selectOneListbox id="selection"
                              valueChangeListener="#{itemSource.itemChanged}"
                              value="#{itemSource.selectedItem}"
                              onchange="submit();"
                              size="4">
            <f:selectItems value="#{itemSource.items}"
                           var="item"
                           itemValue="#{item}"
                           itemLabel="#{item.name}"/>
          </h:selectOneListbox>but now I am getting the following reported:
    Conversion Error setting value 'Item{name=Item3value=Value3}' for 'null Converter'.

  • Multiple columns in a selectOneListbox

    Hi, is there an possibility to put more then one display column in a selectOneListbox?
    I tried it with a String and give it back to the selectOneListbox. This does not work.
    private String getsRow() {
      return "column1     column2     column3 ....";
    <h:selectOneListbox binding="#{Page1.listbox1}" id="listbox1" style="position: absolute; left: 48px; top: 24px; width: 216px; height: 48px" value="">
        <f:selectItems binding="#{Page1.listbox1SelectItems}" id="listbox1SelectItems" value="#{Page1.getSrow()}"/>
    </h:selectOneListbox>Navigating rows via a selectOneListBox is more powerful for the end-user.

    Why don't you use dataTable?
    -roger

  • Possible error when using ADFBC selectOneListbox in a master-detail page

    Hi Everyone,
    I'm trying to setup master - detail page with ADF BC, using Dept / Emp.
    I want to use a listbox for the master object, rather than the form + navigation commands as shown in the classic demos, so I've setup a listbox as following:
    <af:selectOneListbox value="#{bindings.DepartmentsView1.inputValue}"
    label="Available Flows:"
    id="listbox_depts">
    <f:selectItems value="#{bindings.DepartmentsView1.items}"
    id="id_Selcet_Items"/>
    The details element is the classic read-only table created by dragging the Employees view (under the departments) into the page.
    The problem arises when I run the page - the list box shows all the departments, but when I click on different departments the table data does NOT change (as it would when navigating between rows with the classical form navigation buttons).
    I've set up the Table's partial triggers to both of the listbox ids: id_Selcet_Items and listbox_depts but this doesn't help.
    Is this a bug, or am I doing something totally wrong?
    Tal.

    Tal,
    You need to drop the Dept collection onto your page as a navigation list.
    Blaise

  • SelectOneListbox in an editable dataTable

    Hello,
    I am trying to put a listBox in every row of an editable dataTable.
    I am doing the following:
    <h:form>
    <h:dataTable binding="#{myRequestBean.dataTable}" value="#{myRequestBean.dataList}" var="dataItem">
    <h:column>
    <f:facet name="header">
    <h:outputText value="ID" />
    </f:facet>
    <h:commandLink value="#{dataItem.id}" action="#{myRequestBean.editDataItem}" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Comp ID" />
    </f:facet>
    <h:selectOneListbox binding="#{myLists.listbox}"/>
    </h:column>
    </h:form>
    package mymodel;
    import javax.faces.component.html.HtmlSelectOneListbox;
    import java.util.Collection;
    import java.util.ArrayList;
    import javax.faces.model.SelectItem;
    import javax.faces.component.UISelectItems;
    public class MyLists
    private HtmlSelectOneListbox listbox;
    public HtmlSelectOneListbox getListbox() {
    listbox = new HtmlSelectOneListbox();
    Collection collection = new ArrayList();
    collection.add(new SelectItem("11"));
    collection.add(new SelectItem("22"));
    collection.add(new SelectItem("33"));
    UISelectItems listaMenu = new UISelectItems();
    listaMenu.setValue(collection);
    listbox.getChildren().add(listaMenu);
    return listbox;
    }I get the following exception: '#{myLists.listbox}' Target Unreachable, identifier 'myLists' resolved to null
    What am I doing wrong?
    Thank you

    danal wrote:
    > <h:selectOneListbox binding="#{myLists.listbox}"/>I get the following exception: '#{myLists.listbox}' Target Unreachable, identifier 'myLists' resolved to nullYou haven't declared any 'myLists' managed bean in faces-config.xml.

  • SelectOneListBox works with Customer Converter Problem

    I am keeping getting validation error when I try to convert SelectOneListBox String value to Name class which contains FirstName and LastName components.
    here is what I did:
    1. SelectOneList has two String items , I assigned the SelectOneList value to Name backend javabean, the source page code is:
    <h:selectOneListbox styleClass="selectOneListbox" id="listbox1" value="#{pc_Test2View.name}">
    <f:selectItem itemValue="Markus Sonnberg" itemLabel="Markus Sonnberg" />
    <f:selectItem itemValue="Roland Paul" itemLabel="Roland Paul" />
    </h:selectOneListbox>
    2. The definition of Name java bean is:
    public class Name implements Serializable{
         protected String firstName = null;
         protected String lastName= null;
    get/set...()
    3. Create the NameConverter class:
    public Object getAsObject(FacesContext context, UIComponent component, String value) {     
              Name name = new Name();
              System.out.println("..... before value: " + value);
              String[] nameComps = value.split(" ");
              name.setFirstName(nameComps[0]);
              name.setLastName(nameComps[1]);
              System.out.println("1st component of name: "+name.getFirstName());
              System.out.println("2nd component of name: "+name.getLastName());
              return name;
    public String getAsString(FacesContext arg0, UIComponent arg1, Object name) {
              return name.toString();
    4. register NameConverter in faces-config.xml
    <converter>
    <converter-for-class>de.impire.javabean.Name</converter-for-class>     
    <converter-class>de.impire.converter.NameConverter</converter-class>
    </converter>
    5. Run the JSF page, from the console, I saw NameConverter is invoked, but the process aborted due to validation error.
    From cosole:
    [05.06.06 14:34:55:234 CEST] 18637864 SystemOut O 1st component of name: Markus
    [05.06.06 14:34:55:234 CEST] 18637864 SystemOut O 2nd component of name: Sonnberg
    On the JSF page, I got :
    Validation error: the value is not valid.
    Some ideas?

    Could it be that the code doesn't find any value in ZCURR_PM_T table for the specified input region?

Maybe you are looking for

  • Tolerance Limits in PO and MIGO (Goods Receipts)

    Hi, Any one can explain about the following tolerance key relevance. 1. u2022     SE Maximum cash discount deduction, Purchasing - I hope this will work if we activate  system message 06 231 and maintain the cash discount - SKTO. Activated the system

  • Add-AzureAccount - Account1 Ids do not match

    I have been using Azure as a part of my MSDN subscription for a while. I used Azure Powershell to log on to my account and e.g. move data to the blob storage. Everything worked fine. Today I have been assigned to a new subscription. Additionally to m

  • Problem in IDOC Receiving on MII

    Hi I am using MII Version 12.1.4 Build(46). We have configured IDOC in SAP ECC, SAP Netviewer and in MII. We are able to generate iDoc from ECC but we are not able to receive it on MII Message Monitor.

  • BAPI or method to modify Trip Expenses?

    Hello, Im looking for a BAPI in order to change the expenses of a trip (transaction PR05) but i dont find. Do you know any way to change it through a BAPI or method, or my unique alternative is to do a Batch Input? Thank you, Manel

  • M2N78-LA Motherboard BIOS did not detect any Hard Drive

    Hi, I have M2N78-LA Motherboard and the BIOS did not detect ANY hard drive I tried 1- Replaced the HD with another one.  did not work 2- Changed the jumper of HD. did not work 3- Changed the SATA data cable and power cable. did not work. 4- Reset the