SelectOneMenu

Hi,
I have a jsp page in which i am using two dropdown lists(SelectOneMenu) for which i am getting the values from the backing bean using SelectItem[].
On selecting a particular option from the first list the second SelectOneMenu tag is rendered.
Here i am getting the error on selecting the value in the first dropdown list is, whereas if i render some other JSF component(instead of the second dropdown list,it works fine )and i do not get the below mentioned error and the component is rendered but for rendering the second dropdown list i get the followin error:
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Conversion Error setting value ''{0}'' for ''{1}''.
     org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
     com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
     org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
     org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
     com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
     org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281) Please Suggest,
Deepak Edward

Hi Balu,
By sometimes I mean that when I refresh the page the error comes and sometimes the component gets rendered.
I am using version 1.2
The full stachktrace is as follows:
exception
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Conversion Error setting value ''{0}'' for ''{1}''.
     org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
     com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
     org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
     org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
     com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
     org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Conversion Error setting value ''{0}'' for ''{1}''.
     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:839)
     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
     org.apache.jsp.testing_jsp._jspService(testing_jsp.java:80)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
     com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
     org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
     org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
     com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
     org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
root cause
java.lang.IllegalArgumentException: Conversion Error setting value ''{0}'' for ''{1}''.
     com.sun.faces.util.Util.getSelectItems(Util.java:628)
     com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:488)
     com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:465)
     com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)
     javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
     javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:623)
     javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:546)
     com.sun.faces.taglib.html_basic.SelectOneMenuTag.doEndTag(SelectOneMenuTag.java:505)
     org.apache.jsp.testing_jsp._jspx_meth_h_selectOneMenu_1(testing_jsp.java:304)
     org.apache.jsp.testing_jsp._jspx_meth_h_form_0(testing_jsp.java:161)
     org.apache.jsp.testing_jsp._jspx_meth_f_view_0(testing_jsp.java:111)
     org.apache.jsp.testing_jsp._jspService(testing_jsp.java:73)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
     com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
     org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
     org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
     com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:307)
     org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
     org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)

Similar Messages

  • Question regarding selectOneMenu and PROCESS_VALIDATIONS(3) phase

    Hi im a bit lost regarding selectOneMenu and how validation phase all works together.
    The thing is that i have a simple selectOneMenu
    <h:form id="SearchForm">                                                  
         <h:panelGrid columns="3"  border="0">
              <h:outputLabel id="caseTypeText" value="#{msg.searchCaseCaseType}" for="caseType" />                         
              <h:selectOneMenu id="caseType" value="#{searchCaseBean.caseType}" style="width: 200px;" binding="#{searchCaseBean.caseTypeSelect}">     
                   <f:selectItem itemValue="" itemLabel="#{msg.CommonTextAll}" />                                             
                   <f:selectItems value="#{searchCaseBean.caseTypes}"  />                              
              </h:selectOneMenu>
              <h:message for="caseType" styleClass="errorMessage" />
              <h:panelGroup />
              <h:panelGroup />
              <h:commandButton action="#{searchCaseBean.actionSearch}" value="#{msg.buttonSearch}" />
         </h:panelGrid>
    </h:form>Now when i hit submit button i can see that the bean method searchCaseBean.caseTypes (used in the <f:selectItems> tag) is executed in the PROCESS_VALIDATIONS(3) phase. How come? I dont whant this method to be executed in phase 3, only in phase 6.
    If i add the this in the method if (FacesContext.getCurrentInstance().getRenderResponse())
    public List<SelectItem> getStepStatuses(){
         List<CaseStep> caseSteps = new ArrayList<CaseStep>();
         if (FacesContext.getCurrentInstance().getRenderResponse()) {
              caseSteps = getCaseService().getCaseStep(value);     
         List<SelectItem> selectItems = new ArrayList<SelectItem>(caseSteps.size());
         for(int i=0; i < caseSteps.size(); i++){
              CaseStep step = caseSteps.get(i);               
              String stepStatus = step.getStatus() + "_" + step.getSubStatus();           
              selectItems.add(new SelectItem(stepStatus, step.getShortName()));
         return selectItems;
    } Now i get a validation error (javax.faces.component.UISelectOne.INVALID) for the select field and only phase1, phase2, phase 3 and phase 6 is executed.
    Im lost?

    I see. Many thanxs BalusC. Im using your blog very often, and its very helpfull for me.
    I changed now to use the constructor load method instead. But know im getting problem of calling my service layer (Spring service bean). Its seems they havent been init when jsf bean is calling its constructor.
    Can i init the spring service bean from the faces-config file?
    JSF Bean
        public SearchCaseBean() {
              super();
                    //caseService need to be init
              if(getCaseService() == null){
                   setCaseService((CaseService)getWebApplicationContextBean("caseService"));
              fillCaseTypeSelectItems();
              fillCaseStatusSelectItems();
    .....faces-config
    <managed-bean>
              <managed-bean-name>searchCaseBean</managed-bean-name>
              <managed-bean-class>portal.web.SearchCaseBean</managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>          
              <managed-property>
                   <property-name>caseService</property-name>
                   <value>#{caseService}</value>
              </managed-property>
         </managed-bean>

  • How to get submitted Value from SelectOneMenu?

    Hi.
    At the beginning, i would like to say, that i am at the beginning to learn JSP and JSF. I am from germany, so please excuse my english.
    For work i have to develop a form, where the user can select a manufacturer, insert a unique key and get a list of devices after he submits this two attributes.
    At the moment i can not get the value of the selected Item in the selectonemenu.
    I deleted all my trys to get this value, to show you the working parts.
    We work with faces-config.xml, tiles.xml and hybris as platform.
    My code:
    deviceFamilyMain.jsp:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <h:form id="frmDeviceFamilySelect">
      <h:selectOneMenu binding="#{DeviceFamilyBean.selectOneMenuDeviceFamilies}" id="selectOneMenuDeviceFamilies">
         <f:selectItems binding="#{DeviceFamilyBean.dropdownDeviceFamilySelectItems}" id="dropdownDeviceFamilySelectItems" />
      </h:selectOneMenu>
      <h:commandButton action="#{DeviceFamilyBean.detailsAction}" value="Main"/>
    </h:form>
    DeviceFamilyBean:
    public class DeviceFamilyBean extends TC_JSFBean
         //selectOneMenuDeviceFamilies
         HtmlSelectOneMenu selectOneMenuDeviceFamilies = new HtmlSelectOneMenu();
         public HtmlSelectOneMenu getSelectOneMenuDeviceFamilies() {
              return selectOneMenuDeviceFamilies;
         public void setSelectOneMenuDeviceFamilies(HtmlSelectOneMenu selectOneMenuDeviceFamilies) {
              this.selectOneMenuDeviceFamilies = selectOneMenuDeviceFamilies;
         //dropdownDeviceFamilySelectItems
         private UISelectItems dropdownDeviceFamilySelectItems = new UISelectItems();
         public UISelectItems getDropdownDeviceFamilySelectItems() {
                  Object objFacesSession = FacesContext.getCurrentInstance().getApplication()
               .getVariableResolver().resolveVariable(getFacesContext(), "SessionBean");
                  SessionBean sessionBean = (SessionBean) objFacesSession;
              dropdownDeviceFamilySelectItems.setValue(getDropdownDeviceFamilyDefaultItems());
              return dropdownDeviceFamilySelectItems;
         public void setDropdownDeviceFamilySelectItems(UISelectItems dropdownDeviceFamiliesSelectItems) {
                  this.dropdownDeviceFamilySelectItems = dropdownDeviceFamiliesSelectItems;
         //dropdownDeviceFamilyDefaultItems
         private ArrayList dropdownDeviceFamilyDefaultItems = new ArrayList();
         public ArrayList getDropdownDeviceFamilyDefaultItems() {
              Object objFacesSession = FacesContext.getCurrentInstance().getApplication()
              .getVariableResolver().resolveVariable(getFacesContext(), "SessionBean");
              SessionBean sessionBean = (SessionBean) objFacesSession;
            TC_Manager tcDeviceFamilyManager = TC_Manager.getInstance();
            dropdownDeviceFamilyDefaultItems.clear();             
              Collection col = this.getAllDeviceFamilies();
              Iterator itDev = col.iterator();
              while (itDev.hasNext())
                   DeviceFamily deviceFamily = (DeviceFamily) itDev.next();
                   dropdownDeviceFamilyDefaultItems.add(new SelectItem(deviceFamily.getCode()));
              return dropdownDeviceFamilyDefaultItems;
         public void setDropdownDeviceFamilyDefaultItems(ArrayList dropdownDeviceFamilieDefaultItems) {
              this.dropdownDeviceFamilyDefaultItems = dropdownDeviceFamilieDefaultItems;
         //OutputText DeviceFamily Name
         private HtmlOutputText outputTextDevFamName = new HtmlOutputText();
         public HtmlOutputText getOutputTextDevFamName()
             Object obj = FacesContext.getCurrentInstance().getApplication()
            .getVariableResolver().resolveVariable(getFacesContext(), "SessionBean");
             SessionBean sessionBean = (SessionBean) obj;
             if (sessionBean.getCurrentDeviceFamily() != null)
                  outputTextDevFamName.setValue(sessionBean.getCurrentDeviceFamily().getCode());
             } else {
                  outputTextDevFamName.setValue("CurDevFam = null");
              return outputTextDevFamName;
         public void setOutputTextDevFamName(HtmlOutputText outputTextDevFamName) {
              this.outputTextDevFamName = outputTextDevFamName;
         //detailsAction
         public String detailsAction()
                  Object objFacesSession = FacesContext.getCurrentInstance().getApplication()
              .getVariableResolver().resolveVariable(getFacesContext(), "SessionBean");
                  SessionBean sessionBean = (SessionBean) objFacesSession;
                  //sessionBean.setCurrentDeviceFamily((DeviceFamily) this.getDropdownDeviceFamilySelectItems().getValue());
                  return "go_devicefamily_details";
    SessionBean:
         private DeviceFamily currentDeviceFamily;
         public DeviceFamily getCurrentDeviceFamily() {
              return currentDeviceFamily;
         public void setCurrentDeviceFamily(DeviceFamily currentDeviceFamily) {
              this.currentDeviceFamily = currentDeviceFamily;
    go_devicefamily_details is referenced to deviceFamilyDetails:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:view>
        <h:form id="frmDevFamDetails">
            <h:outputText value="#{DeviceFamilyBean.outputTextDevFamName}" />
        </h:form>
    </f:view>I hope i did not forget anything needfull.
    Maybe someone could explain how to get the value and complete the code.
    Thanks.

    Thx 4 the tip.
    I found an other way. It was such easy, that i could kick myself. :-)
    Only in the detailsAction() i needed:
    sessionBean.setCurrentDeviceFamilyName((String) this.getSelectOneMenuDeviceFamilies().getValue());
    I allways looked for dropdownDeviceFamilySelectItems and tryed to get the selected Index, but it is the HtmlSelectOneMenu that carries the value. :-(
    The DeviceFamily Class is an HybrisObject and not easy to initialize.
    I just created a new String (currentDeviceFamilyName).
    Now it works.

  • 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).

  • How to set the number of contents in list area of t:selectOneMenu

    Hi all
    Can any one plz suggest me how to fix size of number listed elements in <h:selectOneMenu> or <t:selectOneMenu>.
    I want to set this size to 10 so that i can control dropdown list size, which appeared quite long and shadows large screen area as well.
    Having list size as 10 can make other elements scrollable through scroll bar of the list.

    Hi Friend
    Can you match this result with this result
    javax.servlet.ServletException: /jsp/admin/SubTopic.jsp(89,8) Attribute size invalid for tag selectManyMenu according to TLD
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:154)
         org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
    as per your suggestions i have implemented following code -
                                  <h:selectManyMenu size="10"
                                                 id="topic" value="#{topicCreationBean.subtopic}"
                                                 style="width: 155px; font-size:10px;">
                                                 <f:selectItem itemLabel="-----------All-----------"
                                                      itemValue="None" />
                                                 <f:selectItems value="#{topicCreationBean.subTopicList}" />
                                            </h:selectManyMenu></td>
    Waiting for your reply.

  • SelectOneMenu does not show the data from the backing bean

    Here is my code:
    <!--
    Fetch the source directory
    -->
    <h:inputText id="dir"
    value="#{myBean.sourceDirectory}"/>
    <!--
    Click this button to refresh the sub-directories list below
    -->
    <h:commandButton value="fetch"
    actionListener="#{myBean.processFetch}" />
    <!--
    Show the list of sub-directories in the directory entered above as a drop
    down
    -->
    <h:selectOneMenu value="#{myBean.selection}">
    <f:selectItems value="#{myBean.dirs}"/>
    </h:selectOneMenu>
    public class MyBean{
    private String sourceDirectory;
    private ArrayList<SelectItem> dirs;
    public String getSourceDirectory(){
    return sourceDirectory;
    public void setSourceDirectory(String newDir){
    this.sourceDirectory = newDir;
    public ArrayList<SelectItem> getDirs(){
    return dirs;
    public void setDirs(ArrayList<SelectItem> newDirs){
    this.dirs = newDirs;
    public void processFetch(ActionEvent e){
    //For this example, we return some hard coded values
    dirs = new ArrayList<SelectItem>();
    SelectItem s1 = new SelectItem();
    s1.setLabel(sourceDir + "_1");
    SelectItem s2 = new SelectItem();
    s2.setLabel(sourceDir + "_2");
    SelectItem s3 = new SelectItem();
    s3.setLabel(sourceDir + "_3");
    SelectItem s4 = new SelectItem();
    s4.setLabel(sourceDir + "_4");
    dirs.add(s1);
    dirs.add(s2);
    dirs.add(s3);
    dirs.add(s4);
    When I run the above code, I notice that the first time, (and the only time), if I hit the "fetch" button the data in the drop-down menu does get refreshed.
    Subsequently, it does not change. I am not sure what I am doing wrong.
    Can someone help me?

    Hi,
    In order to use the JDBC persistence store you have to use a non XA JDBC driver for your Data Source.
    http://docs.oracle.com/cd/E23943_01/web.1111/e13701/store.htm#CNFGD221
    Point-13). When configuring a connection pool to use with WebLogic JMS JDBC Store, use non-XA database drivers.
    http://middlewaremagic.com/weblogic/?p=586
    Hope it helps

  • Is it possible to refresh the dropdown h:selectOneMenu

    Here is my requirement
    The user creates new record by selecting "New" value from the dropdown. Then user enters values on form fields and clicks the Submit button. The result is new Record gets created in the database and also gets populated in the dropdown. But the dropdown still shows the "New" value whereas I want the drop down to dynamically change from "New" to newly created value in the drop down
    The dropdown is populated from the database as shown below
    <h:outputText value="Manufacturer" />                  <h:selectOneMenu id="manufList" value="#{manufacturerBean.selectedManufacturer}" >           <f:selectItem itemLabel="New" itemValue="New" />                                    <f:selectItems value="#{manufacturerBean.manufacturerList}" />                   <a4j:support action="#{manufacturerBean.loadManufacturerDetails}" event="onchange"   reRender="t3,t4,t5,t6,t7,t8,t9,t10" />                        </h:selectOneMenu>       Here is the backing bean
    public List getManufacturerList(){   logger.info(" *** In getManufacturerList Backing Bean*** ");   List<Manufacturer> models = new ArrayList<Manufacturer>();   List<SelectItem> manufacturers = new ArrayList<SelectItem>();   models =  manufManager.getManufacturerList();   logger.info(" *** manufManager List Size=*** "+models.size());      for (Iterator it = models.iterator(); it.hasNext();) {    Object[] row = (Object[]) it.next();    manufacturers.add(new   SelectItem(row[0]+"",row[1]+""));   }        return manufacturers;     }  Any pointers/suggestions will be highly appreciated
    Regards
    Bansi

    If you created the materialized view as UPDATEABLE then changes to it should automatically be relected in the underlying table. If this is not occurring I suggest you check the replication jobs. You probably have a stack of errors in DEFERROR.
    Cheers, APC

  • The itemValue of the selectOneMenu Do Not Show Up in Browser

    I am creating a dropdown menu and users can make only one selection from the menu. I do not have compilation problem. And I am able to see a drop-down in the browser window. Except that when I click on the downward arrow of the dropdown, I see a "blank". All the itemValue that I hard coded in my JSP in the menu do not show up. What was my problem?
    My JSP:
    <af:form>
         <h:selectOneMenu value="#{eaGenerateWordDocHandler.supportingLevel}" style="width:50px">
              <f:selectItem itemValue="0"/>
              <f:selectItem itemValue="1"/>
              <f:selectItem itemValue="2"/>
              <f:selectItem itemValue="3"/>
              <f:selectItem itemValue="4"/>               
         </h:selectOneMenu>
    </af:form>
    .......EaGenerateWordDocHandler.java has the getter and the setter:
         String supportingLevel     = null;
         int level = 0;
         public int getSupportingLevel() {
              String tmpSupportingLevel = getRequest().getParameter("supportingLevel");
              if ( tmpSupportingLevel != null && !tmpSupportingLevel.equals("")){
                 level = Integer.parseInt( tmpSupportingLevel );
              }else{
                   level = 0;
              return level;
         public void setSupportingLevel(String supportingLevel) {
              this.supportingLevel = supportingLevel;
         }faces-config.xml:
    <managed-bean>
         <managed-bean-name>eaGenerateWordDocHandler</managed-bean-name>
            <managed-bean-class>CompanyName.webapp.action.EaGenerateWordDocHandler</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    ...

    Can you try adding itemLabel attribute to f:selectItem.
    <f:selectItem itemValue="0" itemLabel="0"/>

  • How to set value in selectOnemenu using binding

    hi all.
    i have bind htmlSelectOneMenu. it contains some value. I want to set or display a value after a process.
    How to change value
    i have tried using setValue method of both binding property and value property of htmlSelectOneMenu.
    Same issue is with InputTextArea. how to set value in it via code(RowSelectionListener of icefaces)

    Balaji wrote:
    hi all.
    i have bind htmlSelectOneMenu. it contains some value. I want to set or display a value after a process.
    How to change value
    i have tried using setValue method of both binding property and value property of htmlSelectOneMenu.
    Same issue is with InputTextArea. how to set value in it via code(RowSelectionListener of icefaces)The html SelectOneMenu is bound to a value of a backing bean. You have to change the value of that backing bean, not the JSF component directly. JSF takes care of updating the model, you shouldn't be touching it unless you know what you are doing.

  • How to populate a selectOneMenu?

    hello,
    I am working with JSF + managed beans. I want to populate my selectOneMenu with "name" and the value must be "code" (for example) from dataBase.
    (name : jack , value: 1)
    I searched on the web, but only what I found is like :
    <h:selectOneMenu id="selectPaymentTypes" value="#{testBean.paymentType}">
    <f:selectItems value="#{dataSourceBean.dataSource.paymentTypes}" />
    </h:selectOneMenu>
    how can I do to stock both of the label and the value? have I to use a FOREACH Tag with items and var?
    NB: person's name is an arrayList.

    hello,
    I am working with JSF + managed beans. I want to populate my selectOneMenu with "name" and the value must be "code" (for example) from dataBase.
    (name : jack , value: 1)
    I searched on the web, but only what I found is like :
    <h:selectOneMenu id="selectPaymentTypes" value="#{testBean.paymentType}">
    <f:selectItems value="#{dataSourceBean.dataSource.paymentTypes}" />
    </h:selectOneMenu>
    how can I do to stock both of the label and the value? have I to use a FOREACH Tag with items and var?
    NB: person's name is an arrayList.

  • How to get the value of h:selectOneMenu in the javascript

    Hi,
    I want to get the value of <h:selectOneMenu> value in the javascript.... i have tried doing this but it returns null. can anyone plz suggest me a soln for this issue.
    My codes:
    JSF codes are:
    <a4j:form>
    <h:messages/>
    <h:panelGrid columns="2" id="chkpanel">
    <h:outputText value="Add a new root domain:" />
    <h:selectOneMenu id="dmnlst" value="#{domainDetails.selectedDomain}"
    onchange="fielddisable()">
    <f:selectItems value="#{domainTree.allDomains}" />
    </h:selectOneMenu>
    <h:outputText value="Name:" />
    <h:inputText value="#{domainDetails.domain.name}"
    required="true" />
    </h:panelGrid>
    </a4j:form>
    Javascript codes
    function fielddisable()
    var c=document.getElementById("dmnlst");
    alert(c); //am getting null values here....
    Thanks in Advance
    Pandiyan S

    Try a Javascript forum. Java != Javascript.

  • How to get the selected value in SelectOneMenu in backing bean

    Hello all,
    I need your help. I want to have 2 select menus with the second menu's items list are populated based on the selection in the first menu. I don't know how to get the selected value in the backing bean so that I can based on that select menu to populate the second menu's item list. Basically I need to access to the UI Component of the first select Menu and retrieve its selected value.
    Could you help me out?
    Thank you very much in advance,
    Lngo

    Hi Lingo,
    There r two ways of getting the values into the list. First one is hardcoding the values and the second one is use the list and get the values into the list by firing a query in the database.
    Inorder to display the values in the second menu based on the first onces selection we need to add an attribute to the first selectonemenu known as valueChangeListener and we need to sumit the page.
    Here is the sample code
    <h:selectOneMenu id="catalogue"
                                  binding="#{urbean.catalogue}" onchange="submit()"
                                  valueChangeListener="#{urbean.categoryValueChange}"
                                  <f:selectItem itemLabel="Select Catalogue" itemValue="" />
                                  <f:selectItems value="#{urbean.catalogueList}" />
    </h:selectOneMenu>
    <h:selectOneMenu id="category"
                                  binding="#{urbean.category}">     <f:selectItem itemLabel="Select Category" itemValue="" />
                                  <f:selectItems value="#{urbean.categoryList}" />
                                  <                         </h:selectOneMenu>
    now in method called by valuechangelistener we need to write the similar code
    public void categoryValueChange(ValueChangeEvent event) {
    String rfnum = (String) event.getNewValue();
    List categoryList = new ArrayList();
    List tempList = new TablenameDAO().getActiveCatByCatalogueID(rfnum);
              for (int i = 0; i < tempList.size(); i++) {
                   Tablename tablename = (Tablename ) tempList.get(i);
                   String value = "" + tablename .getrfnum();
    String label = tablename .getname();
         if (label == null) {
                   label = "";
                   SelectItem item = new SelectItem(value, label);
                   categoryList.add(item);
              bean.setCategoryList(categoryList);
    ///getActiveCatByCatalogueID (rfnum) should bring the records which r based on the rfnum
    if u follow this process i am damsure that u will get the values in to the secondlist based upon the first list
    Thanks & Regards
    Manidhar

  • How to make use of Listener to auto refresh  items in SelectOneMenu

    Hi,
    I have a transaction jsp page that make use of the SelectOneMenu of which the Selectitems for example consists of all the item_code are added to the dropdownitems through the sessionBean1 ArrayList.
    The problem started when new item_code are being added to the SQL tables using other JSP that allow user to input new item code.
    JSF transaction page using SelectOneMenu could not effectively updated the options to include and reflect the new item subsequently added simply because the page has been rendered to the user .
    I believe using some sort of listener , whenever any action or event took place , JSP that are having the particular UI components being rendered could be auto refresh at the client side of JSP html page.
    Could anyone provide some hints?
    Thank

    Hi,
    Thank for the suggestion,
    In fact I am looking for two possiblity on how to overcome this sort of issues,
    Firstly , if the JSF page has not been rendered , you could always make use of the sessionbean1 to do the job , for example if you add a new item to the selectOneMenu dropitems, you could make use of this method to update the list of items in the dropitems , though it would always be the last items on the sorted list .
    Secondly , using some sort of autorefresh to push to the client to inform the user that new item have been added , advise them to manual refresh the page.
    I am in fact using the first method to add new item to the dropdownmenu for those JSP that involve page forwarding and redirect such as shopping basket / cart beans .
    My concern is when displaying the list of real-time shopping items available to the user , method 1 would not work at all , simply because JSF page was already rendered to the user browser, only beaming alerting message seems to be able to overcome such shortcoming when scenario demand realtime.
    Thank

  • How to get the label on selectOneMenu selected item??

    Hi,
    I'm not able to get the label of the selected item in a selectOneMenu. The code I use to fill it is:
    <h:form id="formNacion" name="formNacion">
    <h:selectOneMenu value="#{modelRtbBean.nacion}" id="selectNacion" onchange="this.form.submit();">
    <f:selectItems value="#{dataRecoveryBean.naciones}" id="idItemsNacion"/>
    </h:selectOneMenu>
    </h:form>
    The dataRecoveryBean has this method to fill the content of the component (basically it creates an arrayList of selectItems by recovering data from a database):
    public ArrayList<SelectItem> getNaciones() {
    if ((naciones == null ) || (naciones.isEmpty()) ){
    naciones = new ArrayList<SelectItem>();
    HDBGeografico hdbGeo = new HDBGeografico();
    SqlMadd sqlmadd = new SqlMadd();
    try {
    AccessBD sscm = new AccessBD( );
    sscm.table(hdbGeo.getSqlNaci());
    // The AccessBD object has a reference to the resultset:
    ResultSet rs = sscm.getRS();
    while (rs.next()) {
    naciones.add(new SelectItem((String) rs.getString(1), (String) rs.getString(2)));
    sscm.Close();
    } catch (Exception e) {
    System.out.println(e.toString());
    return naciones;
    the modelRtbBean setNacion recovers the value, but I need its label too, because it's a kind of description that I use later.
    In the modelRtbBean setNacion method I'm able to access the UISelectItems object, but I cannot get the selected item itself
    public void setNacion(String nacion) {
    FacesContext fc = FacesContext.getCurrentInstance();
    if (fc != null) {
    UIViewRoot viewRoot= fc.getViewRoot();
    System.out.println(viewRoot.getViewId());
    HtmlSelectOneMenu selNac = (HtmlSelectOneMenu)viewRoot.findComponent("bodySTB:formNacion:selectNacion");
    if (selNac != null) {
    System.out.println("Nacion value-htmlSelectOneMenu :" + selNac.getValue() );
    System.out.println(selNac.getAccesskey() + selNac.getTitle() + selNac.toString());
    UISelectItems uis = (UISelectItems)selNac.findComponent("idItemsNacion");
    if (uis != null) {
    System.out.println("I have the element...");
    this.nacion = nacion;
    How could it be accessed this selected item label ??

    I finally did it as you suggest, but I found another way to access the label (I don't know if it could be useful for anybody but here it is) :
    In the setter method linked to the SelectOneMenu, you can put in this code:
    FacesContext fc = FacesContext.getCurrentInstance();
    if (fc != null) {
    UIViewRoot viewRoot= fc.getViewRoot();
    System.out.println(viewRoot.getViewId());
    HtmlSelectOneMenu sel = (HtmlSelectOneMenu)viewRoot.findComponent("viewName:formName:selectOneName");
    if (sel != null) {
    UISelectItems uis = (UISelectItems)sel.findComponent("idItemsName");
    if (uis != null) {
    ArrayList<SelectItem> listElem = (ArrayList<SelectItem>) uis.getValue();
    You could put in in the value item of each SelectItem it's index position in the list, so in the setter method
    of the bean linked to the selectOneMenu you would get the index of the selected item as the parameter of the method
    int index = 1; // For easyness in this example
    System.out.println("Label: " + listElem.get(index).getLabel() + " Value: "+ listElem.get(index).getValue());
    Thanks !!!

  • 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.

  • Need help with SelectOneMenu in a HtmlDataTable: Default Values

    Hello again,
    I have an DataTable in my jsp and 1 of the columns need to be a dropdown.
    Further, I also need the dropdown defaulted to whatever data that is currently in the datatable.
    I can get the dropdown data to display, however I cannot get it to default to a value in each row.
    So far I've got the following:
    jsp:
    <h:dataTable id="dataTable" binding="#{AddSponsors.projectDepartmentsDataTable}" value="#{AddSponsors.projectDepartments}" var="projectDepartments"  border="1" >
    <h:column>
       <f:facet name="header" >
          <h:outputText value="Department" styleClass="labelcell"/>     
       </f:facet>
       <h:selectOneMenu value="#{projectDepartments.deptCode}">
          <f:selectItems value="#{AddSponsors.selectItemsDepartment}" />
       </h:selectOneMenu>
    </h:column>**Note that AddSponsors.projectDepartments is a list of the object AddSponsorsDTO.
    AddSponsorsDTO:
    public class AddSponsorsDTO implements java.io.Serializable{
       private String deptCode;
       private String deptName;
       private Double percentAllocation;
      //getters and setters for the above
    }session scoped backing bean:
    I have the dropdown populated fine like this:
    //getter for the dropdown
    public List<SelectItem> getSelectItemsDepartment() {
       fillSelectItemsDepartment();
       return selectItemsDepartment;
    //fill the dropdown
    public void fillSelectItemsDepartment(){
       TbDepartment t;
       List l = this.tbDepartmentDAO.findAll();
       selectItemsDepartment = new ArrayList<SelectItem>();
       for (Iterator i = l.iterator(); i.hasNext();){
          t = (TbDepartment) i.next();
          selectItemsDepartment.add(new SelectItem(t.getDeptCode(), t.getDeptName()));
    }How is an item selected in the dropdown. Let's say programatically for example? By deptCode?
    Am I missing anything here?
    Thanks!
    Nick
    Edited by: nicksan on Nov 15, 2007 4:14 PM

    I revisited that page and now I understand a bit more clearly.
    The key for me was the LinkedHashedMap and the get() method.
    As you suggested, I also created a DTO to store the key and value.
    Then I populate the Map like this:
    selectListDTOMap = new LinkedHashMap<String, SelectListDTO>();
    for (Iterator i = l.iterator(); i.hasNext();){
       t = (TbDepartment) i.next();
       selectListDTOMap.put(t.getDeptCode(),  new SelectListDTO(t.getDeptCode(), t.getDeptName()));
    }Then I've got another method that populates the actual SelectItems.
    selectItemsDepartment = new ArrayList<SelectItem>();
    List<SelectListDTO> list = new ArrayList<SelectListDTO>(selectListDTOMap.values());
    for(SelectListDTO dto : list){
       selectItemsDepartment.add(new SelectItem(dto.getKey(), dto.getValue()));
    }I also have a valueChangeListener like this:
    public void selectItemChanged(ValueChangeEvent event){
       String newValue = (String) event.getNewValue();
       SelectListDTO dto = (SelectListDTO) selectListDTOMap.get((String)event.getNewValue());
       AddSponsorsDTO s = (AddSponsorsDTO) projectDepartmentsDataTable.getRowData();
       s.setDeptCode(dto.getKey());
       s.setDeptName(dto.getValue());
       s.setDataItemStatus(AddSponsorsDTO.NewModified);
       //set the new data to the datatable data          
       projectDepartments.set(projectDepartmentsDataTable.getRowIndex(), s);
    }Makes sense?

Maybe you are looking for

  • Error while doing consumption posting

    Dear all, There is sufficient amount of quantity for particular batch,but while posting consumption it is showing error. Error is: Deficit of BA Unrestricted use. please guide me to solve this issue. Regards, santosh.

  • Effective and actual ppi?

    What's the difference between effective and actual ppi? Is there any reason I need to adjust the actual ppi if it's more than 300 x 300 ppi?

  • Need a flash player for ipad

    Not able to download adobe flash player to view a seating chart- what are my options

  • Music from pod to comp

    Recently my father has wiped out all memory on my comp for god only knows why. Anyway all the music that was on my itunes is gone, and most of the cds i got for the itunes are long gone as well. so if i want to get any new music on my ipod it says i

  • Data transfer en speed test

    Dear all, We are currently examining the location of a new server for BI. In order to do so, we want to know how much data is currently transferred from R/3 to BW, and also how much data is transferred when calling up a query. We want both Europe and