Problem in selectonemenu

hi..
i want to send the selected data in selectonemenu from jsp to my bean for the backendprocess.
value attrib in selectonemenu is used to send only d selected no of value.
here is the code;
-----Original Message-----
<htm:td id="searchviewtd11">
     <h:selectOneMenu id="searchviewselectone1" value="#{SearchBean.currentcustomerName}" styleClass="ee119">
                                        <f:selectItems id="searchviewselectitems1" value="#{SearchBean.customerName}"/>
                                   </h:selectOneMenu>
                                   </htm:td>=================
- here in selectitems 'customerName' is the list tat dynamically fetch data from the table by some cond. say,, it is having values like:
christopher
deni
vinoth
-from the above 3 values i select 'deni' and i want to send this data to a bean. if i use value attrib in selectonemenu it sends the 'currentCustomerName' as 1. but i need the name itself ie 'deni' in a string variable.
help me to solve this.. asap. tanx in adv...

SelectOneMenu works as follows:
JSF<h:selectOneMenu value="#{myBean.selectedItem}">
    <f:selectItems value="#{myBean.selectItems}" />
</h:selectOneMenu>MyBeanpublic List getSelectItems() {
    List selectItems = new ArrayList();
    selectItems.add(new SelectItem("key1", "value1"));
    selectItems.add(new SelectItem("key2", "value2"));
    selectItems.add(new SelectItem("key3", "value3"));
    return selectItems;
public void setSelectedItem(String selectedItem) {
    this.selectedItem = selectedItem;
    // this sets the key (key1, key2 or key3) and NOT the value.
    // the value is that what is been displayed in the menu to the user.
}HashMap is also an option, but I should use LinkedHashMap instead, because by default the HashMap is not ordered. However a List as shown in my example is most preferable.

Similar Messages

  • Problem with selectOneMenu in Datatable

    Hi
    I have the following datatable that binds correctly to a set of Game objects.
    I need to have a dropdown with the numbers 1 to 10 as items which is bound to each dataItem's newRating field.
    However there is some problem with the dropdown that i can't figure out. The datatable stops rendering when it hits the first dropdown.
    At the moment,
    The new rating field in the Game class is of type SelectItem with the appropriate get and set methods.
    Could anyone please point out what I'm doing wrong
    Thanks.
    Here is the relevant part in Home.jsp:
                                              <h:dataTable binding="#{Home.newGamesTable}" id="newGamesTable" value="#{Home.newGames}" var="dataItem">
                                                                <h:column>
                                                                    <f:facet name="header">
                                                                        <h:outputText value=""/>
                                                                    </f:facet>
                                                                    <h:panelGroup layout="block" styleClass="new_game_main">
                                                                        <h:outputText styleClass="new_game_title" value="#{dataItem.title}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Date added: "/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.dateString}"/>
                                                                        <h:outputText escape="false" styleClass="new_game_label" value="Average Rating:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.rating}"/>
                                                                        <h:outputText styleClass="new_game_label" value="Uploaded by:"/>
                                                                        <h:outputText styleClass="new_game_data" value="#{dataItem.userName}"/>
                                                                        <h:commandLink styleClass="new_game_label" value="Play Now!"/>
                                                                        <h:selectOneMenu styleClass="new_game_rating" value="#{dataItem.newRating}">
                                                                            <f:selectItems value="#{ratingItems}" />
                                                                        </h:selectOneMenu>
                                                                        <h:commandLink action="#{Home.rateNewGame}" styleClass="message_link" value="Rate"/>
                                                                    </h:panelGroup>
                                                                </h:column>
                                                            </h:dataTable>and Home.java
    private List<SelectItem> ratingItems = null;
         public List<SelectItem> getRatingItems()
             if (ratingItems == null)
                 ratingItems = new ArrayList<SelectItem>();
                 for (int i = 1; i <= 10; i++)
                     SelectItem item = new SelectItem();
                     item.setValue(Integer.valueOf(i));                        
                     ratingItems.add(item);
             return ratingItems;
         public void setRatingItems(List<SelectItem> items)
             ratingItems = items;        
        private List<Game> newGames = null;
        private boolean hasNewGames;
        public List<Game> getNewGames()
            if (newGames ==null)
                newGames = DataFactory.getNewGames();           
            hasNewGames = !newGames.isEmpty();
            return newGames;
        }

    What do you mean by stops rendering? Can you paste the relevant portion of the output (from view source in the browser).

  • Problem populating selectOneMenu from backing bean

    i want to populate my selectOneMenu with items from a backing bean, but items never show up.
    jsf code
    <h:selectOneMenu >
                          <c:forEach var="item" items="#{club.list}">
                              <f:selectItem itemLabel="#{item}" itemValue="#{item}"/>
                           </c:forEach>
                          </h:selectOneMenu>
                        faces-config.xml
    <managed-bean>
        <managed-bean-name>club</managed-bean-name>
        <managed-bean-class>entities.ClubController</managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
      </managed-bean>bean code. i have omitted the unnecessary code
    public class ClubController {
        public ClubController() {
        private List<String> list;
        public List<String> getList()
             list=new ArrayList();
             list.add("item 1");
             list.add("item 2");
             return list;
    }

    This exception usually appears if your bean throws an exception in initializer/constructor. Try adding log statements top your constructor to see what's wrong.
    I believe getServiceLocator() or getServiceLocator().getAdministracionVirtualService() or getServiceLocator().getAdministracionVirtualService().getAllCategorias() is null.

  • SelectOneMenu with properties file

    hi guys,
    I've got a problem with selectOneMenu.
    Basically setting the itemValue to static text is ok and everything works fine
    <f:selectItem itemLabel="#{others['dr']}" itemValue="Dr" />but if I set the itemValue to a property, I get a NullPointerException
    <f:selectItem itemLabel="#{others['dr']}" itemValue="#{others['dr']}" />here's the exception
    java.lang.NullPointerException
         javax.faces.component._SelectItemsIterator.hasNext(_SelectItemsIterator.java:73)
         javax.faces.component._SelectItemsUtil.matchValue(_SelectItemsUtil.java:47)
         javax.faces.component.UISelectOne.validateValue(UISelectOne.java:56)
         javax.faces.component.UIInput.validate(UIInput.java:354)
         javax.faces.component.UIInput.processValidators(UIInput.java:184)any suggestions?
    cheers
    c

    Looking at the source for MyFaces 1.1.5 it looks as though the select item is reporting both itemLabel and itemValue as null in order to generate the given stack trace. When does the error occur? I.e. during rendering or during submit? It looks as if it is during submit, are you sure the necessary beans are in place to resolve the EL expression upon submit?

  • H:selectOneMenu and its value parameter trouble

    Hello!
    I have a form in my jsp page ^
    <h:dataTable id="table" value="#{Reference.template.fields}" var="list" rowClasses="list_row_odd, list_row_even" columnClasses="align_right, align_left" width="100%" border="0" cellpadding="4" cellspacing="1">
                <h:column rendered="#{(list.label != 'code')}">
                  <h:outputText value="#{list.label}" escape="false"/>
                </h:column>
                <h:column rendered="#{(list.optionsSize < 1)&&(list.label != 'code')}">
                  <h:inputText id="ref_input" value="#{Reference.faculty}" readonly="true" rendered="#{list.label == '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;'}" size="50"/>
                  <h:inputText id="ref_input_1" value="#{list.value}" rendered="#{(list.label != '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;') && (list.value == '')}" size="50"/>
                  <h:inputText id="ref_input_2" value="#{list.value}" readonly="true" rendered="#{(list.label != '&#1060;&#1072;&#1082;&#1091;&#1083;&#1100;&#1090;&#1077;&#1090;') && (list.value != '')}" size="50"/>
                </h:column>
                <h:column rendered="#{(list.optionsSize > 0) && (list.label != 'code')}">
    // here is the problem -----------------------------
                  <h:selectOneMenu id="list" value="#{list.value}">
                    <f:selectItems value="#{list.options}" />
                  </h:selectOneMenu>
                </h:column>
                <h:column rendered="#{(list.label != 'code')}">
                  <h:outputText value="#{list.lov}" escape="false"/>
                </h:column>
              </h:dataTable>the trouble is if there is a value parameter, the form is submitted to server
    as empty one, if there isn't value parameter it works well.
    list.getValue - returns String
    and i strongly need to show the selected value!!!1
    Please help

    I'm not talking about JavaScript.
    I would like to write my own Java function:
    String formatStatus(String status, Date date) {
    If (status.equals("A"))
    return "Active from date " + date;
    else
    return "Not active";
    and then to replace inside my dataTable's column:
    <h:outputText id="text2" value="#{varpaketi.status}" />
    with:
    <h:outputText id="text2" value="#{pc_Paketi.formatStatus($status, $date)}" />
    where $status and $date are dataset variables which were displayed in column of my datatable.

  • SelectOneMenu and custom object

    Hi everybody,
    i have problems using selectOneMenu component.
    <h:panelGroup rendered="#{Navi.rendered}">
                        <h:selectOneMenu id="selPerson" value="#{Navi.user}">
                             <f:selectItems value="#{Navi.list}"/>
                        </h:selectOneMenu>
                   </h:panelGroup>Here is the code from the backing bean:
    private List list;
    private User user;
    public List getList() {
              if (list == null){
                   loadDefault();
              return list;
         public void setList(List list) {
              this.list = list;
         public User getUser() {
              return user;
         public void setUser(User name) {
              this.user = name;
         }The list is loaded from db as follows:
    while (result.next()){
         User user = (User) result.get(0);
         userlist.add(new SelectItem(user,user.getFirstname()+ " 
            "+user.getSurname(),user.getScreenName()));
    }I get a validation error when trying to get the value from the list. Can anybody help? Regards,
    ak

    Hi Sushil,
    To write to the activity stream, these are the things you need
    1) A service definition in service-definition.xml . Similar to here http://docs.oracle.com/cd/E15523_01/webcenter.1111/e10148/jpsdg_svc_intro.htm#JPSDG506
    2) Use the ActivityStreaming API to publish the event. (Note: I have only tried this from within WebCenter Portal so I can't be sure how the API may be called remotely)
         a) oracle.webcenter.activitystreaming.ActivityStreamingService.createActivityElement() to construct the activity element
         b) oracle.webcenter.activitystreaming.ActivityStreamingService.publish() to publish the activity element.
    I can try and distil my code into a sample later this week.

  • JSF1.2+JSTL1.1 bug?

    Hi,
    I get some strange behavior of my site. Sorry for posting the hole code, I cannot reproduce this bug in simpler example.
    The thing is when I login and get into home page, if I press refresh button on browser the part of login page appears at the end of my home page.
    I have a main index.jsp page that includes login.jsp, home.jsp. It should include either login.jsp, or other one, but not both!
    I beleive that problem is not in my backbeans, so I'm including only these three pages. Again, sorry for my code:
    index.jsp:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Title</title>
            <link rel="stylesheet" type="text/css" href="style.css">
        </head>
    <body>
        <f:view>
    <table cellpadding="0" cellspacing="4" border="0" width="100%">
        <c:if test="${indexManager.auth}">
        <tr><td width="120px" >
        </td><td>
            <h:form id="group_select">
                Choose a group of problems:
                <h:selectOneMenu value="#{indexManager._problemsGroupID}">
                    <f:selectItems value="#{indexManager.problemsGroupsSelectList}" />
                </h:selectOneMenu>
                <h:commandLink
                    value="Apply"
                    action="#{indexManager.doNavigate}"
                    styleClass="navigate">
                    <f:setPropertyActionListener target="#{indexManager.includePageName}" value="Problems" />
                </h:commandLink>
            </h:form>
        </td></tr>
        </c:if>
        <tr><td width="120px" >
        </td><td bgcolor="#004080" height="16">
            <img src="/images/top.gif" width="16" height="16" border="0">
        </td></tr>
    <tr><td width="120px" valign="top">
            <f:subview id="menu">
                <jsp:include page="WEB-INF/menu.jsp" />
            </f:subview>
    </td>
    <td valign="top">
        <f:subview id="include" rendered="#{indexManager.includePage != null}">
            <jsp:include page="${indexManager.includePage}" flush="true" />
        </f:subview>
    </td>
    </tr>
    </table>
    </f:view>
    </body>
    </html>home.jsp:
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <h:form id="home_form">
    <c:forEach items="#{problemsManager.problemsGroupsList}" var="groupItem">
        <h2>
        <h:outputText value="#{groupItem.name}" escape="false" />
        </h2>
        <h:outputText value="#{groupItem.description}" escape="false" />
        <h:commandLink
            value="More"
            action="#{indexManager.setIncludePage}"
            styleClass="navigate" >
            <f:setPropertyActionListener target="#{indexManager.includePageName}" value="Problems" />
            <f:setPropertyActionListener target="#{indexManager.problemsGroupID}" value="#{groupItem.groupID}" />
        </h:commandLink>
    </c:forEach>
    </h:form>login.jsp:
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <c:set var="reloadPage" value="${indexManager.reloadPage}" />
    <c:remove var="reloadPage" />
    <h1>Problems database</h1>
    <hr style="height:8px; width:100%; border: 0px; background-color: #004080">
    Please, log in to view the contents of site.<br>
    <h:outputText
        rendered="#{indexManager.errMsg != null}"
        value="#{indexManager.errMsg}"
        style="color: red;" />
    <h:form id="login_form">
        <h:panelGrid columns="2">
            <h:outputText value="Username" />
            <h:inputText value="#{indexManager.username}" />
            <h:outputText value="Password" />
            <h:inputSecret value="#{indexManager.password}" />
            <h:panelGroup />
            <h:commandButton value="login" action="#{indexManager.doLogin}">
                <f:setPropertyActionListener target="#{indexManager.includePageName}" value="Home" />
            </h:commandButton>
        </h:panelGrid>
    </h:form>The part of the login page that appears in home page is:
    <form id="include:login_form" name="include:login_form" method="post" action="/ProblemsDataBase/faces/index.jsp" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="include:login_form" value="include:login_form" />
    <table>
    <tbody>
    <tr>
    <td>Username</td>
    <td><input type="text" name="include:login_form:j_id_jsp_840041046_4pc3" value="guest" /></td>
    </tr>
    <tr>
    <td>Password</td>
    <td><input type="password" name="include:login_form:j_id_jsp_840041046_6pc3" value="" /></td>
    </tr>
    <tr>
    <td></td>
    <td><input type="submit" name="include:login_form:j_id_jsp_840041046_8pc3" value="login" /></td>
    </tr>
    </tbody>
    </table>
    <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id16:j_id20" />
    </form>Thanks for looking into my mess :)

    Actually, I introduced <f:subview> tags when I was trying to get rid of this bug. If I delete all <f:subview> tags the problem is still the same.
    PS And if I put <f:subview> tags in include pages as you said, everything remains the same.
    Edited by: nacre on Jun 30, 2008 3:15 PM

  • Problem while setting the selected value of h:selectOneMenu to bean

    Hi all,
    I am new to JSF. I am working on application where i have combo boxe on the page. I am setting some values to the combobox from database using <f:selectItems> tag and one value using <f:selectItem> tag. The value combobox value selected by user is set to the bean property which is String. I am able to display all the values in the combobox but when clicked on button (present at the end of form) i am getting following error-
    ERROR HtmlRendererUtils:354 - Error finding Converter for
    component with id interviewStageOneForm:acceptanceChannelList
    I am setting the combobox selected value to the to the bean property which is String and the value selected in also String. Then which converter it is asking for. I am not able to find out what is the problem.
    Your suggestions will be really appreciated.
    Here is my code snippet:-
    JSF:-
    <h:selectOneMenu id="acceptanceChannelList"
         value="#{interviewStageOneBean.index}">
         <f:selectItem itemValue="Select" itemLabel="#{Message.combo_select}" />
         <f:selectItems value="#{MasterDataBean.acceptanceChannelList}" />  <!-- The list coming from database-->
    </h:selectOneMenu>Bean:-
    public class InterviewStageOneBean {
         private String index;
         public String getIndex() {
              return index;
         public void setIndex(String index) {
              this.index = index;
    }

    Hi!
    First I would try next:
    Try to leave out
    <f:selectItem itemValue="Select" itemLabel="#{Message.combo_select}" />
    line. And check if it works after that. If it didn't repeat step but you leave in message selectItem and dump out database selectItem line.
    Second:
    I would check acceptanceChannelList creation and what type of objects you put while doing setValue and setLabel on UISelectItem
    Probably selectItem value has been assigned an object of type the engine doesn't know how to convert from String to it.

  • H:selectOneMenu - Update problem through a Java Function

    Hi,
    I'm designed a little form which has two h:selectOneMenu.
    <h:form>
    <h:selectOneMenu id="listas_disponibles"
                                 value="#{sesion.listaSeleccionada}"
                                 valueChangeListener="#{sesion.escogerLista}"
                                 onchange="submit();"
                                 immediate="true">
        <f:selectItems value="#{sesion.listasConfiguracionIDNombre}"/>
    </h:selectOneMenu>
    <h:selectOneMenu id="listas_hijas"
                                value="#{sesion.listaHijaSeleccionada}"
                                valueChangeListener="#{sesion.escogerListaHija}"
                                onchange="submit()">
        <f:selectItems value="#{sesion.listasHijas}" />
    </h:selectOneMenu>The problem is that when I change the "listas_hijas" value, I want update the "listas_disponibles" value through the "sesion.escogerListaHija" method.
    public void escogerListaHija(ValueChangeEvent value){
    this.listaSeleccionada
    = idListNewValue;
    }But when the JSF page is rendered, the value of "listas_disponibles" hasn't changed.
    Can anybody help me? Need you more data or code? Thanks!!

    Try to access your list through the ValueBinding.In your function
    FacesContext context = FacesContext.getCurrentInstance();
    context.getApplication().createValueBinding("#{sesion.listaSeleccionada}").setValue(context, idListNewValue);
    you must have the setter for you list.

  • JSF problem with h:selectOneMenu

    Hi Friends,
    First of all i would like to thank u all for ur previous valuable suggestions. I got stucked up with a problem.
    I have a dropdown list in which i have only 2 values 'Remodeling' and 'New'. When the user selects the option 'Remodeling' , i need to render a group of checkboxes.I tried lot many ways but didn't work.
    Could anyone plz help me out on this. Below is my sample code:
    Code to display drop down list
    <h:selectOneMenu value="#{gfmCoverageABean.constructionType}" valueChangeListener="#gfmCoverageABean.onConstructionTypeChange}">
    <f:selectItems id="typeOfConstructionProject" value="#{gfmCoverageABean.typeOfConstructionProjectList}" />
    </h:selectOneMenu>
    Code to render checkbox when drop down option selected is 'Remodeling'
    <h:outputLabel id="foundationLbl" for="foundation" value="#{PolicyLabels['GfmCoverageADetails.Foundation']}"
    rendered="#{gfmCoverageABean.constructionType eq 'Remodeling'}"/>
    <ig:checkBox id="foundation" value="#{gfmCoverageABean.gfmCoverageView.foundation}"
    rendered="#{gfmCoverageABean.constructionType eq 'Remodeling'}"/>
    Problem here is my checkbox is not getting displayed on any case.
    Thanks
    vijay

    Hello Vijay
    Displaying group of Checkboxes
    Use Value Change Listener and Create and panel Grid and render it to false
    in SelectOneMenu when the value is change it calls valueChangeListener
    there u check the event value if it is ur choice render panel grid to true simple.
    <h:selectOneMenu value="#{Bean.selectedCategories}"
              valueChangeListener="#{Bean.processValueChange}" onchange="this.form.submit();">
                   <f:attribute name="optionClasses" value="option1, option2" />
                   <f:selectItem itemLabel="Please select Industry" />
                   <f:selectItems value="#{Bean.selectCategories}" />
              </h:selectOneMenu>
    <h:panelGrid id="chkBox" binding="#{Bean.panel}" rendered="false">
    private HtmlPanelGrid panel = new HtmlPanelGrid();
    ///generate setter and getter
    public void processValueChange(ValueChangeEvent ae) throws Exception
              if(ae.getNewValue().equals("URChoice")){          
    getPanel().setRendered(true);
    This will solve the problem

  • JSF 1.2_13 (Mojarra) -  h:selectOneMenu problem

    I have this JSF tag in my JSP form:
    <h:selectOneMenu id="selectLang" value="#{langList.selectedItem}">
          <f:selectItems value="#{langList.selectItems}" />
    </h:selectOneMenu>and this backing bean:
         private List<SelectItem> selectItems;
         private String selectedItem;     
            createList();
        // getter methods
        public List<SelectItem> getSelectItems() {
             return selectItems;
        public String getSelectedItem() {
             return selectedItem;
        // setter method
        public void setSelectedItem(String selectedItem) {
             this.selectedItem = selectedItem;
        private void createList()
            selectItems = new ArrayList<SelectItem>();       
            selectItems.add(new SelectItem("1", "English"));
            selectItems.add(new SelectItem("2", "Fran&ccedil;ais"));
        }I found that I can't change "selectedItem" and "selectItems" to say, for example "selectedLang" and "selectLangs" respectively in both the JSF tag and the matching backing bean method. How odd! It seems to me that the above definitions can't be changed. If I changed them to any name at all, I get the dreaded "JSF1054: (Phase ID: RENDER_RESPONSE 6..." error - which is not really helpful in identifying the problem.
    I also have another problem with "h:selectOneMenu" but I guess I might to wait for your responses before I post the problem here or in another thread.
    BTW, have search the forums for existing discussion but didn't find one resembling my problem. I have already lost two days trying to figure this problem out - but not successful. Maybe the solution might be really simple...
    Can someone please help? Sorry if I make any mistake since this is my very first post - just joined about 30 minutes ago -:)
    cheers and regards

    Further to my reply above, I've tried Mojarra (1.2_12-b01-FCS) and the new Mojarra 2.0.0 (RC b16) releases and am able to replicate the same problem with these releases - one cannot rename "selectItems" and "selectedItem" in the JSF tag as well as the backing bean. Anyway, here is my full backing bean code in the hope that someone can see a problem with it:
    package example;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.model.SelectItem;
    public class LangGenerator
         private List<SelectItem> selectItems;
         private String selectedItem;     
            createList();
        // getter methods
        public List<SelectItem> getSelectItems() {
             return selectItems;
        public String getSelectedItem() {
             return selectedItem;
        // setter method
        public void setSelectedItem(String selectedItem) {
             this.selectedItem = selectedItem;
        private void createList()
            selectItems = new ArrayList<SelectItem>();
            selectItems.add(new SelectItem("1", "English"));
            selectItems.add(new SelectItem("2", "Français"));
    }and my TEST.JSP codes:
    <%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Example</title>
    </head>
    <body>
         <f:view>
              <h:form id="form1">
                   <h:panelGrid>
                        <h:panelGroup>          
                             <h:selectOneMenu id="selectLang" value="#{langList.selectedItem}">
                                  <f:selectItems value="#{langList.selectItems}" />
                             </h:selectOneMenu>                                                  
                        </h:panelGroup>
                   </h:panelGrid>
              </h:form>                                                                                
         </f:view>
    </body>
    </html>The PROBLEM: If I left the names as "selectItems" and "selectedItem" it render the page fine. But if I change them to "selectLangs" and "selectedLang" respectively in both the JSF tag and the supporting backing bean - it will not work, period. I'm very confused now.
    Is this a bug with the Mojarra JSF implementation?

  • H:selectOneMenu and converter problem

    Hello
    I'm working on an application (Address Database) using JSF (Base JSF libs with IBM Faces). Apache Tomcat Server 5.5.
    Since days i'm trying to solve my problem with h:selectOneMenu and converter. I can save values correctly, but i cannot display the saved value again as a selected item.
    so here is my jsf code section:
         <h:selectOneMenu value="#{personBean.person.representative}"
                        styleClass="fldDefault fldcombo">
                        <f:selectItems value="#{partnerBean.representatives}" />
                        <f:converter converterId="keywordConvertor" />
                        <f:attribute name="SelectItemArrayList"
                             value="#{partnerBean.representatives}" />
         </h:selectOneMenu>
    representatives are keywords and in the selectOneMenu, a representative keyword object is stored.
    here is my partnerBean.jsp Code:
         private List<SelectItem> representatives = null;
         * populate keywords of type REPRESENTATIVE
         public void populateRepresentatives() {
              representatives = new ArrayList<SelectItem>();
              ArrayList<Keyword> representativeKeywords = kwHandler
                        .getKeywordsByType(KW_REPRESENTATIVE_TYPE);
              for (Keyword keyword : representativeKeywords) {
                   representatives.add(new SelectItem(keyword, keyword
                             .getKwDescription()));
    so the function gets the representative keyword objects, loop through them and add a newly created SelectItem Object to the representatives list.
    There is a converter in order to save and display (should!!) the values:
    public class KeywordConvertor implements Converter {
         public Object getAsObject(FacesContext context, UIComponent component,
                   String value) {
    ....code for saving...
         public String getAsString(FacesContext context, UIComponent component,
                   Object obj) {
    `          System.out.println(((Keyword) obj).getId()+"");
              return ((Keyword) obj).getId()+"";
    i did not provide the code for getAsObject, since the saving of the combo box works fine. If it has to do something with my problem, please ask me for this code..
    The System.out.prinln prints all ids correctly, but the generated HTML Code does not select the given value in the combobox.
    So whats wrong with the getAsString Method? or is the function completely somewhere else?
    I have to say that the function ((Keyword) obj).getId() returns a long !! is that the problem?
    Any help is very appreciated

    Hello
    i implemented the function in the Keyword Class:
    public class Keyword implements Serializable {
         public boolean equals(Keyword kw) {
              System.out.println("calling equals in:" + kw.getId());
              if (kw.getId() == this.getId()) {
                   return true;
              } else {
                   return false;
    but the System.out.print is not executed...
    i tried also:
         public boolean equals(Object o) {
              Keyword kw = (Keyword) o;
              System.out.println("calling equals in:" + kw.getId());
              if (kw.getId() == this.getId()) {
                   return true;
              } else {
                   return false;
    but then i get the following error message:
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: could not initialize proxy - no Session
    hmmm, could you show me how to implement the equals Function correctly?

  • Problem while using h:selectOneMenu tag

    Hello All,
    I am facing a problem while using the <h:selectOneMenu in my JSP.
    My requirement is as below,
    I am having a list of manager in the select box.
    User will select any of the manager and click a command link to assign the manager.
    On click of this command link backerbean method should be invoked.
    My problem is,
    I am able to display the list box without any problem.
    But Once I select any value from the list box the command link is not working.
    That is click on the command link is not invoking the backer bean method.
    My code look as below,
    JSP
    <td>                 
    <h:selectOneMenu value="#pc_EmployeeDetailsView.assignedMgrPositionId}" id="assignedMgrPositionId" style="width: 170px">
    <f:selectItems value="#{pc_EmployeeDetailsView.managerList}" />
    </h:selectOneMenu>
    </td><td>�</td>
    <td><h:commandLink action="#pc_EmployeeDetailsView.assignManager}" onmousedown="setEditAction('assign');">
    <h:outputText value="Assign"></h:outputText>
    </h:commandLink></td>Backer Bean
         SelectItem managerSelectItem =  new SelectItem("0","Select Manager");
         ArrayList managerSelectItemList = new ArrayList(); 
         managerSelectItemList.add(managerSelectItem);
         int managerListSize = managerSearchList.size();
         for (int i=0; i<managerListSize; i++) {
              Employee manager = (Employee) managerSearchList.get(i);
              managerSelectItem =  new SelectItem(StringUtils.isNotEmpty(manager.getOrgInfo().getPositionNumber())?manager.getOrgInfo().getPositionNumber():"",StringUtils.isNotEmpty(manager.getFullDisplayName())?manager.getFullDisplayName():"");
              managerSelectItemList.add(managerSelectItem);
         setManagerList(managerSelectItemList);Please help me on this.
    Thanks In Advance

    I have solved this problem by putting the list in portlet session and allowing the get method to get the SelectItem from the session

  • Problem with a datatable and selectOneMenu

    Hello
    I'm pretty new at java, so this might be an easy problem to solve, but I've been stuck in this for a couple of days now, so any help will be appreciated.
    I have a selectOneMenu item that when it's changed this value loads the info for a datatable below it, this works fine.... but I need that when for example, the select one menu has the value "1", the data tabla loads the activities for the option "1", inside the datatable there is a checkbox for a column, now, in this scenario, when I check 3 options in the datatable, I need to change the value in the selectOneMenu and put, for example the value "2", when this happens now I have to reload the datatable with the values corresponding to the activities for the option "2".
    The problem is when I change the value of the selectOneMenu on the backingBean, because this selectOneMenu has implemented the onchange event, but this is only activated if the the value is changed in the UI, not in the code as I need to do it.
    This are the lilbs that I'm using:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
    <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    This is the fragment of code of the selectOneMenu:
    <h:selectOneMenu id="ddlTipoVisita" value="#{VisitaDomiciliarBean.idTipoVisita}" disabled="#{VisitaDomiciliarBean.modoEdicion == false}"
    rendered="#{VisitaDomiciliarBean.mostrarSegunOpcionMenu}">
    <f:selectItems value="#{VisitaDomiciliarBean.selectItemsTipoVisita}" />
    <a4j:support status="statustablaSubtipoVisita" event="onchange" action="#{VisitaDomiciliarBean.cargarTablaSubtipoVisita}" reRender="tablaSubtipoVisita">
    </a4j:support>
    </h:selectOneMenu>
    This is the datatable section:
    <t:dataTable id="tablaSubtipoVisita" styleClass="scrollerTable2" headerClass="standardTable_Header"
    footerClass="standardTable_Header" rowClasses="standardTable_Row1,standardTable_Row2"
    columnClasses="columna_centrada" value="#{VisitaDomiciliarBean.subtiposVisita}" var="subtipo"
    preserveDataModel="false" rows="10" >
    <%--columna de seleccion multiple--%>
    <t:column rendered="#{VisitaDomiciliarBean.seleccionMultiple == true}">
    <f:facet name="header">
    <h:outputText value="#{recursos['actividades.seleccionar']}" />
    </f:facet>
    <a4j:region>
    <h:selectBooleanCheckbox
    value="#{subtipo.seleccionado}" disabled="#{VisitaDomiciliarBean.modoEdicion == false}">
    <a4j:support event="onchange" status="statustablaSubtipoVisita"
    actionListener="#{VisitaDomiciliarBean.seleccionar}" reRender="ddlTipoVisita" >
    </a4j:support>
    </h:selectBooleanCheckbox>
    </a4j:region>
    </t:column>
    <t:column>
    <f:facet name="header">
    <h:outputText value="#{recursos['actividades.descripcion']}"/>
    </f:facet>
    <h:outputText value="#{subtipo.descripcion}"></h:outputText>
    </t:column>
    </t:dataTable>
    Is there any way to do this using the rendered option of the components? Or does anybody has another idea or recomendation?
    I tried to solve it using two data tables, one for the option "2" and another for all the rest of the options, I tried to hide or show the one I need acoording to the data inside the array that has the info for the datatables, but this failed, because when I change the value for the selectOneMenu from the bean, both datatables are shown and not only the one that I need.
    I would really appreciate any help with this!
    Greetings,

    Well turns out I had a some bad code in the back end that was resetting the model to the 'initial' value. I didn't require the FacesContext.getCurrentInstance().renderResponse(); after all.
    But I still find it disturbing the model generator code being called twice.
    If anyone has any suggestions on how to prevent this I'm all ears.

  • Problem rendering JSF selectManyListbox component from JSF selectOneMenu

    hello all. i have a problem rerender-ing selectManyListbox in "onchange" event of selectOneMenu.
    When i used both component as selectOneMenu then rerender-ing works fine but my requirement is to select many option and size also should be set which cannot be done in selectManyMenu component. so my tryint to use selectManyListbox
    So, when i change the rerender-ing component to selectManyListbox then rerendering doesnt work in onchange event of selectOneMenu.
    how can i use the selectManyListbox as rerender in onchange event of selectOneMenu?? please help and thanks in advance. please be free to answer to my post
    NOTE: i have specified 3 component
    1. selectManyListbox
    2. selectOneMenu
    3. selectManyMenu

    Did you found a solution to the problem?
    I am having similar problem in my page.
    Thanks,
    Bablu

Maybe you are looking for

  • Download Button in Web Report

    Hi Experts, I want to Add a Click Button on my Web Template. Which would let me download the report in Excel File. On click of the button it should show my target place as desktop or download folder. Do anyone know whether we have any option in Bex W

  • Getting ORA-00054

    Our application is getting the following error... SQL> select * from cmd where CC0034_CMD_NRI = 111 for update nowait; select * from cmd where CC0034_CMD_NRI = 111 for update nowait ERROR at line 1: ORA-00054: resource busy and acquire with NOWAIT sp

  • I cannot install Adobe CS5.5 on my PowerPC G5

    Hi, I hope someone can help me! I have a PowerPC G5, purchased brand new in 2005. I tried to install Adobe Creative Suite 5.5 on the machine but I got an error message that 'my architecture was not supported'. On contacting Adobe, I was informed that

  • Upgrade or Refurbish

    I'm at a point where I need to restart my iPhone 5 multiple times a day to be able to connect to the internet at all. My upgrade date is 2 weeks away. Is there any way to go ahead and upgrade my phone now rather than deal with troubleshooting my curr

  • List Box display to synchroniz​e with Scroll bar.

    I will like to know if anyone here can help to amend or advise on the attached VI in order to allow the List Box display to synchronize with the Scroll bar. As the VI is in run mode, i would like to see 9.CD, 10.Troja, 11. Red... and so on to be disp