SelectOneMenu & f:selectItems ordering

I have some strange action occuring when I assign a hashmap to the f:selectItems in my selectOneMenu. I can get the menu to work correctly for the option selected by the user, though the map isn't output in the order I would like.
My backing bean has simple code like
Map  map = new HashMap();
map.put("a", "a");
map.put("b", "b");
map.put("c", "c");
transferObject.setMap(map);Now I would expect the JSP code below to output the options in the order a,b,c but this isn't the case, it outputs them in a mixed up order.
JSP code
<h:selectOneMenu id="num_id" value="#{TransferObject.area}"       immediate="true" onchange="submit()"
valueChangeListener="#{ActionBean.changeFunctionalArea}">
         <f:selectItems id="select_option" value="#{TransferObject.map}"/>
</h:selectOneMenu>Any help on why the order isn't the same as the order the elements are added is much appreciated.
Thanks
Michael.

JavaDoc states:
Value binding expression pointing at a List or array of SelectItem instances containing the information for these options.
Map should not be used.
See this recent thread:
http://forum.java.sun.com/thread.jspa?threadID=726161&tstart=30
Hope this helps,
CowKing

Similar Messages

  • SelectOneMenu rendering SelectItems List twice

    Hi All,
    I have a bit of a problem I have not been able to track down. I have a JSP that sometimes duplcates my list data in a SelectOneMenu and sometimes the data is only listed once...ie: the list might have selectItem entry values of { All, None } and sometimes {All, None, All, None }.
    The SelectOneMenu code is as follows::
    <td width="*" class="bodyCopy">
           <aa:zoneJSF id="ReleaseZone">                         
                  <h:selectOneMenu id="release" styleClass="bodyCopy" value="#{filterBean.selectedRelease}" immediate="true" >
                                                <f:selectItems value="#{filterBean.release}"/>
                  </h:selectOneMenu>
            </aa:zoneJSF>
    </td>I do see the getter on the FilterBean being invoked multiple times, though I don't think that's the problem as I see the "Release" list data always returning only 2 values (never duplicated). So what confuses me is why the values in the list would be duplicated (or rendered more then once).
    Incase you were wondering, the <aa:> tag is for using Ajax Anywhere with JSF tags.
    Any leads would be appreciated. I don't think of myself as a JSF newbie, but I'm really beginning to suspect otherwise.
    Regards,
    ~Rob.

    It's not clear to me why I'd need to do a list.clear() in the backing bean, but I'll give it a shot. I don't know that I'd need to do this as the getter always returns the correct number of elements in the list.
    But by way of disclosing more information about my backing bean with regards to the release info, see below:
    // --- From the FilterBean object ---
        private SelectItem[] release = null;
        public FilterBean()
            setupReleaseList("All");
            SessionUtil.getSession().setAttribute("filterBean", this);
        public SelectItem[] getRelease()
        {   return(release);    }
        public String setupReleaseList( String _version )
            StringBuffer xml = new StringBuffer();
            xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
                 xml.append("<options><option value='All'>All</option><option value='N''>None</option>");
                this.release      = new SelectItem[2];
                this.release[0] = new SelectItem("A","All");
                this.release[1] = new SelectItem("N","None");
            xml.append("</options>");
            return (xml.toString());
        }I started kicking around an idea of using xml, but at htis point It's probably a dead end.

  • SelectOneMenu/SelectItems with Date fields

    I have trying to create a list of dates (hh:mm a) using selectOneMenu and selectItems. I can get things to display fine, but when the form is submitted, I get an error message similar to: "Conversion Error setting value 'Tue Sep 21 00:00:43 CDT 2004' for 'null Converter'."
    My understanding of the selectitems tag in JSF is that the datatype for its value must be the same as the value for the corresponding selectOne component. I've also read that it is not necessary to explicity declare a converter in this case
    I've tried doing to same but declaring a converter. Doing that, however, I get a "Validation Error: {0}Value is not valid" which would seem to suggest that my datatypes are not matching up.
    I've listed the relevant code below. Could someone please take a look and see if I'm missing something or does JSF just not support what I am attempting? Thanks.
    I am using the following in my jsf page:
    <h:selectOneMenu id="toTime" value="#{data.toTime}">
         <f:selectItems value="#{data.timeSelection}"/>
    </h:selectOneMenu>
    data.toTime:
    public void setToTime(Date newToTime)
         toTime = newToTime;
    data.timeSelection:
    public List getTimeSelection() {
         List timeArray = new ArrayList();
         DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.SHORT);
         GregorianCalendar calTime = new GregorianCalendar();
         calTime.set(GregorianCalendar.HOUR, 12);
         calTime.set(GregorianCalendar.MINUTE, 00);
         calTime.set(GregorianCalendar.AM_PM, GregorianCalendar.PM);
         for(int i=0; i<48; i++)
              timeArray.add(new SelectItem(calTime.getTime(), dateFormat.format(calTime.getTime())));
              calTime.add(GregorianCalendar.MINUTE, 30);
         return timeArray;
    }

    I had to resort to using Strings instead of dates. I have a time-driven application (dates only, not time).
    I have formatted by selectOneMenu values to be yyyyMMdd strings. Within the backing beans, I have a method that takes the strings and parses these strings back to dates before I manipulate them within my bean.
    Kind of ugly, but it works.

  • Dynamically create a SelectOneMenu

    Hi All,
    I have a JSF page on which I need to dynamically create and bind a SelectOneMenu. In order to do this I have the following code (all in a request-scoped bean used by the JSF page):
    List<SelectItem> values;
    // Called after a button is clicked on the page
    public void createMenu() {
        values = new Vector<SelectItem>();
        // Load the values to be displayed
        HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
        menu.add(items);
        UISelectItems items = new UISelectItems();   
        ValueExpression expr = // Get ValueExpression pointing to this request-scoped bean's 'values' attribute
        items.setValue("value", expr);
        // Create the SelectOneMenu inside a binded panel on the screen
        getCustomPanel().getChildren().add(menu);
    public List<SelectItem> getValues() {
        return values;
    }This works fine and the SelectOneMenu is displayed correctly and contains the correct values. However, as soon as I perform any type of postback (navigation, clicking on buttons/links on the page), I receive the following exception:
    [#|2008-03-07T11:57:24.296+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=21;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=bcebfe92-27ee-416d-a3d5-7916f5480fe4;|StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
    java.lang.IllegalArgumentException
         at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:166)
         at javax.faces.component.SelectItemsIterator.next(SelectItemsIterator.java:49)
         at javax.faces.component.UISelectOne.matchValue(UISelectOne.java:164)
         at javax.faces.component.UISelectOne.validateValue(UISelectOne.java:137)
         at javax.faces.component.UIInput.validate(UIInput.java:867)
         at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
         at javax.faces.component.UIInput.processValidators(UIInput.java:666)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
         at javax.faces.component.UIForm.processValidators(UIForm.java:229)
         at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
         at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
         at org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:57)
         at org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:319)
         at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
         at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
         at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:333)
         at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
         at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
         at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
         at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    |#]I tried adding breakpoints to all my getters and setters and the constructor of the request-scoped bean, and as they are never triggered I assume this exception occurs before my code is actually accessed. As far as I can tell, for some reason, on creating a postback the value binding of the UISelectItems component is null and as such it can't find the SelectItems it needs. I don't know why this is or how to fix it, though. This doesn't happen if the component isn't created dynamically, and unfortunately our business requirements are as such that I have to create it dynamically.
    Your help would be much appreciated as this really got me stumped and I really need this functionality to be in the project.
    Thank you,
    Ristretto

    Okay ... here's a small proof of concept I created:
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
        <body>
            <f:view>     
                <h:form>
                    <h:panelGrid>
                     <h:commandButton value="Load SelectOneMenu" action="#{pageBean.loadMenu}" />
                  <h:commandButton value="Create Postback" action="#{pageBean.doNothing}" />
              </h:panelGrid>
              <h:panelGrid binding="#{pageBean.panel}" />
             </h:form>
            </f:view>
        </body>
    </html>
    public class PageBean {
        private HtmlPanelGrid panel;
        private List<SelectItem> selectItems;
        public HtmlPanelGrid getPanel() {
            return panel;
        public void setPanel(HtmlPanelGrid panel) {
            this.panel = panel;
        public List<SelectItem> getSelectItems() {
            return selectItems;
        public void setSelectItems(List<SelectItem> selectItems) {
            this.selectItems = selectItems;
        public void loadMenu() {      
            selectItems = new Vector<SelectItem>();
            SelectItem selectItem1 = new SelectItem("first", "First Option");
            SelectItem selectItem2 = new SelectItem("second", "Second Option");
            selectItems.add(selectItem1);
            selectItems.add(selectItem2);
            HtmlSelectOneMenu menu = new HtmlSelectOneMenu();
            UISelectItems items = new UISelectItems();
            ValueExpression expr = getValueExpression("#{pageBean.selectItems}");
            items.setValueExpression("value", expr);
            menu.getChildren().add(items);
            panel.getChildren().add(menu);
        public void doNothing() {
        private ValueExpression getValueExpression(String expression) {
            ExpressionFactory expressionFactory = FacesContext.getCurrentInstance().getApplication().getExpressionFactory();
            ELContext expressionContext = FacesContext.getCurrentInstance().getELContext();
            return expressionFactory.createValueExpression(expressionContext, expression, Object.class);
    }Step 1: Click on "Load SelectOneMenu".
    Step 2: Click on "Create Postback".
    Thanks for having a look at it.
    Ristretto

  • BUG - JSF f:selectItem

    JDeveloper Version: 10.1.3.0.4(SU4)
    Build JDEVADF_10.1.3_NT_060125.0900.3673
    Linux (fedora core 5) and Windows 2000.
    Setting the f:selectItem itemLabel or itemValue attribute to '<=' causes page to not compile.
    Values of '<', '>','>=' work fine.
    wysiwyg rendering on the design tab fails with message detail:
    java.lang.NullPointerException
         at oracle.jdevimpl.webapp.model.css.html.HtmlCSSManager.getCSSValuesAssigner(HtmlCSSManager.java:46)
         at oracle.jdevimpl.webapp.view.DisplayManager.generateBoxes(DisplayManager.java:1683)
         at oracle.jdevimpl.webapp.view.DisplayManager.generateView(DisplayManager.java:1674)
         at oracle.jdevimpl.webapp.view.DisplayManager.showContent(DisplayManager.java:1650)
         at oracle.jdevimpl.webapp.view.DisplayManager.showContent(DisplayManager.java:647)
         at oracle.jdevimpl.webapp.editor.XmlGuiEditor.showContent(XmlGuiEditor.java:266)
         at oracle.jdevimpl.webapp.editor.html.HtmlEditor.updateDisplay(HtmlEditor.java:754)
         at oracle.jdevimpl.webapp.editor.AbstractWebAppEditor.rebuildViewDocument(AbstractWebAppEditor.java:689)
         at oracle.jdevimpl.webapp.editor.html.HtmlEditor.rebuildViewDocument(HtmlEditor.java:621)
         at oracle.jdevimpl.webapp.editor.jsp.JspEditor.rebuildViewDocument(JspEditor.java:209)
         at oracle.jdevimpl.webapp.editor.AbstractWebAppEditor.editorShown(AbstractWebAppEditor.java:456)
         at oracle.jdevimpl.webapp.editor.html.HtmlEditor.editorShown(HtmlEditor.java:447)
         at oracle.ideimpl.editor.SplitPane.doLayoutBottomTabs(SplitPane.java:617)
         at oracle.ideimpl.editor.SplitPane.doLayout(SplitPane.java:480)
         at java.awt.Container.validateTree(Container.java:1473)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validateTree(Container.java:1480)
         at java.awt.Container.validate(Container.java:1448)
         at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:379)
         at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:113)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    =====================================
    Example JSF page:
    =====================================
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=US-ASCII"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/>
    <title>test</title>
    </head>
    <body><h:form>
    <h:selectOneMenu>
    <f:selectItem itemLabel="<=" itemValue="<="/>
    </h:selectOneMenu>
    </h:form></body>
    </html>
    </f:view>
    ===================
    thanks.

    Setting the f:selectItem itemLabel or itemValue attribute to '<=' causes page to not >compile. Values of '<', '>','>=' work fine.Probably giving us the exact steps you did would help us.
    1. Did you change the property through PI or from code editor?
    2. Was the code editor and design editor open at the same time (as split windows?)
    3. Did you make the change in code editor and switched to design editor?
    Thanks,
    --srini                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dynamic values for JSF selectOneMenu using javascrpt. JSF validation error.

    Hi,
    Im using Myfaces 1.2 (tomahawk) . I have a very bulky page having lot of drop down menus. It has a datatable containing four drop downs in a row and the datatable has close to 40 rows (with pagination) . Each of the drop downs have close to 100 items . This makes the page size very huge and not suitable for an internet application.
    Im thinking of a way to have the drop downs populated using javascript in body onload event so that the page size reduces drastically. I have defined a selectOneMenu without selectItems. So before page load there will be no items in the drop down. The body onLoad method populates the drop downs and the page gets rendered as expected. All the javascript events related to these drop downs works fine. When page is submitted i want the selected value in the bean variable.
    But when the page gets submitted im getting the error
    Validation Error: Value is not valid
    Can someone let me know the reason behind this and a way to solve this problem . Its really URGENT...
    Please help....
    Thanks,
    Swami.

    JSFdeveloper wrote:
    Validation Error: Value is not valid During validations phase, the submitted value of UISelectOne/UISelectMany will be tested against the current SelectItems. If it is not covered by the SelectItems, you will get this error.
    Its really URGENT...This is your own problem, not our problem. This way you're only trying to move the problem/pressure to us and pushing us to respond soon. This is considered very rude in terms of netiquette. Next time you do so, I have no problem adding you to my ignore list. [Just ask questions the smart way|http://catb.org/esr/faqs/smart-questions.html].

  • Urgent - can't set managed bean value using a form, getting null

    I have a form with a bean -- unbelievably, I can't get the values entered into the form by the user to get stored into the bean. Everything is null... I've looked at a zillion examples, posts and compared etc...yet still can't see what is missing.
    Here's part of a trace :
    [cc]Dec-31 01:25:02 ApplicationImpl - Created bean resourceBean successfully
    [cc]Dec-31 01:25:02 ApplicationImpl - Storing resourceBean in scope request
    [cc]Dec-31 01:25:02 VariableResolverImpl - resolveVariable: Resolved variable:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - getValue Result:id=null name=null
    [cc]Dec-31 01:25:02 ValueBindingImpl - -->Returning id=null name=null
    If you have any ideas, please let me know--it seems just as I solve one JSF issue, I run into another on unexpectedly simple things.
    Here's the ResourceBean.java, the bean-config.xml and my jsp.
    package com.intalio.qa.tcm.view.beans;
    import java.util.Map;
    import javax.faces.context.FacesContext;
    import javax.faces.model.SelectItem;
    import org.apache.log4j.Logger;
    import com.intalio.qa.exceptions.DuplicateIdException;
    import com.intalio.qa.tcm.model.Resource;
    import com.intalio.qa.tcm.view.builders.ResourceBuilder;
    import com.intalio.qa.tcm.view.util.FacesUtils;
    * Resource backing bean.
    public class ResourceBean extends RootBean {
         * Class logger
         public static final Logger LOG =
              Logger.getLogger(ResourceBean.class);
    * The Resource id
         private String id = null;
         * The Resource name
         private String name = null;
    * Description
    private String description= null;
         * the resource type id associated with the Resource
         private String resourceTypeId= null;
         private static SelectItem[] resourceTypeIds = new SelectItem[] {
              new SelectItem("External Software"),
              new SelectItem("Hardware"),
              new SelectItem("Intalio Product Software"),
              new SelectItem("Machine - Dual CPU"),
              new SelectItem("Machine - CPU Single"),
              new SelectItem("Memory - UNIX"),
              new SelectItem("Memory - Windows") };
    * @return Returns the resourceTypeIds.
    public SelectItem[] getResourceTypeIds() {
    return resourceTypeIds;
    * @param resourceTypeIds The resourceTypeIds to set.
    public void setResourceTypeIds(SelectItem[] typeIds) {
    resourceTypeIds = typeIds;
         * Default constructor.
         public ResourceBean() {
    super();
    init();
         * Initializes ResourceBean.
         * @see RootBean#init()
         protected void init() {
         /*True, but I'd strongly recommend instead using:
    FacesContext fContext = FacesContext.getCurrentInstance();
    Map requestParams = fContext.getExternalContext().getRequestParameterMap();
    String companyId = (String) requestParams.get("companyID");
    The getRequest(), getSession(), and getContext() methods of ExternalContext should only be used as a last resort.*/
         * Backing bean action to update Resource.
         * @return the navigation result
         public String updateAction() {
              LOG.info("updateAction is invoked");
              try {
                   Resource Resource = ResourceBuilder.createResource(this);
                   LOG.info("ResourceId = " + Resource.getId());
              //     viewServicesManager.getResourceService().updateResource(Resource);
              } catch (Exception e) {
                   String msg = "Could not update Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error.");
                   return ActionResult.FAILURE;
              LOG.info("Resource with id of " + id + " was updated successfully.");
              return ActionResult.SUCCESS;
         * Backing bean action to create a new Resource.
         * @return the navigation result
         public String addAction() {
              try {
                   Resource resource = ResourceBuilder.createResource(this);
    LOG.info("resource created: " + resource.getName() + " with typeId = " + resource.getResourceTypeId());
                   viewServicesManager.getResourceService().saveResource(resource);
              } catch (DuplicateIdException de) {
                   String msg = "This id already exists";
                   LOG.info(msg);
                   FacesUtils.addErrorMessage(msg);
                   return ActionResult.RETRY;
              } catch (Exception e) {
                   String msg = "Could not save Resource";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(msg + ": Internal Error");
                   return ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was created successfully.";
              LOG.info(msg);
              return ActionResult.SUCCESS;
         * Backing bean action to delete Resource.
         * @return the navigation result
         public String deleteAction() {
              LOG.info("deleteAction is invoked");
              try {
         //          Resource Resource = ResourceBuilder.createResource(this);
         //          viewServicesManager.getResourceService().deleteResource(Resource);
                   //remove the ResourceList inside the cache
    //               FacesUtils.resetManagedBean(BeanNames.RESOURCE_LIST_BEAN);
              } catch (Exception e) {
                   String msg = "Could not delete Resource. ";
                   LOG.error(msg, e);
                   FacesUtils.addErrorMessage(null, msg + "Internal Error.");
                   return ActionResult.FAILURE;
              String msg = "Resource with id of " + id + " was deleted successfully.";
              LOG.info(msg);
              FacesUtils.addInfoMessage(msg);
              return ActionResult.SUCCESS;
         public String getId() {
              return id;
         * Invoked by the JSF managed bean facility.
         * <p>
         * The id is from the request parameter.
         * If the id is not null, by using the id as the key,
         * the Resource bean is initialized.
         * @param newQueryId the query id from request parameter
         public void setId(String newId) {
              LOG.info("setId " + newId);
              id = newId;
         public String getName() {
              return name;
         public void setName(String newName) {
              name = newName;
         public String getDescription() {
              return description;
         public void setDescription(String newDescription) {
              description = newDescription;
         public String getResourceTypeId() {
              return resourceTypeId;
         public void setResourceTypeId(String newResourceTypeId) {
              resourceTypeId = newResourceTypeId;
         public String toString() {
              return "id=" + id + " name=" + name;
         <!-- view -->
         <managed-bean>
              <description>
                   Managed bean
              </description>
              <managed-bean-name>applicationBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ApplicationBean
              </managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
              </managed-bean>
         <managed-bean>
              <description>
                   View service manager impl for business services
              </description>
              <managed-bean-name>viewServicesManagerBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ViewServicesManagerBean</managed-bean-class>
              <managed-bean-scope>application</managed-bean-scope>
         </managed-bean>
         <managed-bean>
              <description>
                   Backing bean that contains product information.
              </description>
              <managed-bean-name>resourceBean</managed-bean-name>
              <managed-bean-class>
                   com.intalio.qa.tcm.view.beans.ResourceBean
              </managed-bean-class>
              <managed-bean-scope>request</managed-bean-scope>
              <managed-property>
                   <property-name>viewServicesManager</property-name>
                   <value>#{viewServicesManagerBean}</value>
              </managed-property>
         </managed-bean>
    </faces-config>
    <f:view>
         <h:form id="createResourceForm" target="dataFrame">
              <h:outputText value="#{applicationBean.dummyVariable}" rendered="true" />
              <div align="center">
              <head>
              <link href="../../css/stylesheet.css" rel="stylesheet" type="text/css">
              <FONT color="#191970" size="4" face="Arial">Resources View</FONT>
              </head>
              <table style="margin-top: 2%" width="35%" cellpadding="10">
                   <div align="left">
                   <FONT color="#191970" size="3" face="Arial">Update Resources </FONT>
                   </div>
                   <tr>
                        <td align="center" valign="top" align="center" style="" bgcolor="white" />
                        <table>
                             <tbody>
                                  <tr>
                                       <td align="left" styleClass="header" width="100" />
                                       <td align="left" width="450" />
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Id" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.id}" id="id"/> <h:message for="id" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100"><h:outputText value="Name" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.name}" id="name" /> <h:message for="name" styleClass="errorMessage" /></td>
                                  </tr>
                                  <tr>
                                       <!--td align="right" width="100" valign="bottom"><h:outputText value="Type" /></td>
                                       <td align="left" width="550"><h:selectOneMenu>
                                            <f:selectItems value="#{resourceBean.resourceTypeIds}" />
                                       </h:selectOneMenu> <h:outputText value="#{resourceBean.resourceTypeId}" id="dresourceTypeId" /> <h:message for="resourceTypeId" styleClass="errorMessage" />
                                       </td>
                                  </tr>
                                  <tr>
                                       <td align="right" width="100" valign="bottom"><h:outputText value="Description" /></td>
                                       <td align="left" width="450"><h:inputText value="#{resourceBean.description}" id="description" size="96" /> <h:message for="description" styleClass="errorMessage" /></td>
                                  </tr>
                             </tbody>
                        </table>
         </h:form>
         </td>
         <!-- END DATA FORM -->
         <!-- BEGIN COMMANDS -->
         <td width="30%" align="left" valign="top"><h:form id="buttonCommandsForm">
              <h:panelGroup id="buttons">
                   <h:panelGrid columns="1" cellspacing="1" cellpadding="2" border="0" bgcolor="white">
                        <h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
                        </h:commandButton>
                        <h:commandButton id="deleteCB" value="Delete" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.deleteAction}">
                        </h:commandButton>
                        <h:commandButton id="spaceFillerButton" style="height:21px; width:51px;font-size:8pt;background-color: #ffffff;color: #ffffff;border: 0px;">
                        </h:commandButton>
                        <h:commandButton id="saveCB" value="Save" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.saveAction}">
                        </h:commandButton>
                        <h:commandButton id="updateCB" value="Update" style="height:21px; width:51px;font-size:8pt" action="#{resourceBean.updateAction}">
                        </h:commandButton>
                   </h:panelGrid>
              </h:panelGroup>
         </h:form> <!-- end buttons --></td>
         </tr>
         </table>
         <HR align="center" size="2" width="60%" />
         <!-- data table -->
         </div>
    </f:view>
    THANKS.
    -L

    I solved this.
    Since I was testing the action code only, I didn't define a navigation entry corresponding to the action string returned for this button:
    <h:commandButton value="Add" style="height:21px; width:51px;font-size:8pt; font-color: black;" action="#{resourceBean.addAction}">
    </h:commandButton>After I added a nav definition, it worked. I don't know why at this point. I suspect a key step in the lifecycle was pre-empted...someone else can probably explain why. If I get a chance to research it after I'm done with my project, I'll update this post.
    Thanks.
    -L

  • Problem with binding of a selectManyCheckbox inside a dataTable

    Hi,
    first i want to point out that my english is not the best. :)
    A german version is followed at the end of the english text.
    I have a class "MyClass" with few attributes like:
    private long id;
    private String text;
    private Set<MyClass2> childs;
    An a second class "MyClass2" wich also have some attributes:
    private long id;
    private String text;
    Now i have a List with lots of objects from typ "MyClass":
    List myList = new ArrayList();
    // Sample Data!!
    for (int i=0; i<100; i++)
    MyClass1 m1 = new MyClass1();
    m1.setId(i);
    m1.setText("MyClass1 Line " + i);
    // Now add some "childs":
    for (int j=0; j<i*2; j++)
    MyClass2 m2 = new MyClass2();
    m2.setId( i );
    m2.setText("Sample "+ i);
    m1.getChilds().add(m2);
    myList.add ( m1 );
    So now i want to show the ID and text every Object of MyClass1 on my "test.jsp" (width JSF Tags).
    The Collections inside this class should display as checkboxes (value = id, label = text).
    Sample:
    ID: +1+ TEXT: MyClass1 Line 1
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    ID: +2+ TEXT: MyClass1 Line 2
    CHECKBOXES:
    [x] Sample 0
    [x] Sample 1
    [x] Sample 2
    [x] Sample 3
    Okay i think you know what i mean. ;-)
    I tryed it also with a dataTable to iterate in "myList" and use a selectOneMenu with selectItems to generate the checkboxes.
    Here is the code:
    <h:dataTable value="#{myBean.myList}" var="rowInstance" binding="#{myBean.dataTable}" id="dataTable">
    <h:column>
    <h:outputText value="ID: #{rowInstance.id}" />
    <h:outputText value="TEXT: #{rowInstance.text}" />
    </h:column>
    <h:column>
    <h:selectManyCheckbox id="cbox" styleClass="checkbox">
    <f:selectItems value="#{myBean.childs}"/>
    </h:selectManyCheckbox>
    </h:column>
    </h:dataTable>
    Maybe you see the that i've used childs in the selectItems.
    This is a methode like that:
    public SelectItem[] getChilds()
    MyClass1 mc1 = (MyClass1) dataTable.getRowData();
    // now i iterate the childs and make for each a SelectItem()
    Also you maybe see that i have no binding on selectManyCheckbox, because i have no idea how it works. :-)
    I've tried to bind it to a String[] but and the end this String[] always contain the last low.
    My Question is now:
    When the user pressed the submit Button how can i figure out which Checkboxen the user clicked ?
    Thank you a lot.
    Now the german version (surley better explained):
    Hallo nochmal,
    ich habe versucht auf englisch mein Problem zu schildern.
    Was mit sicherheit nicht zu 100% gelungen ist, deshalb hier noch mal eine deutschsprachige Version (maybe some germans out there).
    Wie oben abgeblidet habe ich im Prinzip zwei Klassen.
    Die erste Klasse "MyClass1" hat eine Collection die Objekte von der Klasse "MyClass2" enth�lt.
    Nun m�chte ich auf meiner JSP Seite die JSF Tags benutzt eine Liste von Objekten (die vom Typ "MyClass1" sind) abbilden.
    Die Collection innerhalb dieser Klasse soll als Checkboxen dargestellt werden.
    Ich habe es ohne gro�e Probleme hinbekommen, dass er das so anzeigt wie ich das m�chte.
    Nur habe ich z.Z. noch Probleme damit wie ich sp�ter herausfinde, welche der Checkboxen denn nun angew�hlt sind.
    Normalerweise w�rde man ja ein binding machen, so k�nnte man alle ausgew�hlten Checkboxen (getSelectedValues()) ja bekommen.
    Da aber die Anzahl der Objekte immer unterschiedlich ist kann ich nicht die entsprechenden Variablen anlegen.
    Deshalb die Frage: Wie bekomme ich mit welche der Checkboxen ausgew�hlt wurden? Wie muss das binding aussehen?
    Vielen Dank.
    Greetings from Germany. :)

    Just bind it to the row object.
    JSF<h:dataTable value="#{myBean.myDataList}" var="myData">
        <h:column>
            <h:selectManyCheckbox value="#{myData.selectedItems}">
                <f:selectItems value="#{myData.selectItems}" />
            </h:selectManyCheckbox>
        </h:column>
    </h:dataTable>MyDataprivate List<String> selectedItems; // + getter + setter
    private List<SelectItem> selectItems; // + getter

  • Can't find bundle for base name... and selectOne tags

    I have a problem. I have a little application with internationalization working very well. But when i introduce a selectOneMenu tag i get the following error:
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Can't find bundle for base name MessageBundle, locale en
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
         org.apache.jsp.pages.default_jsp._jspService(default_jsp.java:121)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         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)
         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.apache.jasper.runtime.PageContextImpl
    When I take off the selctOneMenu tag and every thing work well again.
    the code of the page is the following:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:loadBundle basename="localizations.MessageBundle" var="bundle"/>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <f:view>
    <%@ include file="/pages/includes/header.jsp" %>
    <h:selectOneMenu>
         <f:selectItems value="#{pruebaBean.condiments}"/>
    </h:selectOneMenu>
    </f:view>
    </body>     
    </html>
    The pruebaBean code is the following:
    public class PruebaBean {
         private Map condiments = null;
         public Map getCondiments() {
         if(condiments == null) {
         condiments = new HashMap();
         condiments.put("Cheese", new Integer(1)); // key,value
         condiments.put("Pickle", new Integer(2));
         condiments.put("Mustard", new Integer(3));
         condiments.put("Lettuce", new Integer(4));
         condiments.put("Onions", new Integer(5));
         return condiments;
         public PruebaBean() {
         public void setCondiments(Map condiments) {
              this.condiments = condiments;
    The MessageBundle work well, the problem i think is something with the selectOneMenu.
    Help me please.

    a) You can't use map for that purpose.
    b) You have to create SelectItem objects
    c) If you return an array of selectItem on this method condiments, it will go ok.

  • Conversion Error setting value ''{0}'' for ''{1}''

    Hi
    I have to populate a drop-down list on my page with the values coming from the DB.
    JSF code:
    <td align="right"><div id="wait" style="visibility:hidden;">Select an existing Application</div></td>
    <td align="left"><div id="wait1" style="visibility:hidden;" >
    <h:selectOneMenu id="exist" value="#{processApplication.selectedOwner}" styleClass="selectOneMenu">
    <f:selectItems value="#{processApplication.existingOwners}"></f:selectItems>
    </h:selectOneMenu>
    </div>
    </td>
    processApplication bean:
    public List<SelectItem> getExistingOwners() {                    
    //existingOwners = this.getOwners();
    try{
         List < SelectItem > existingOwners = new ArrayList < SelectItem > ( ) ;
         SelectItem si_0 = new SelectItem();
         SelectItem si_1 = new SelectItem();
    SelectItem si_2 = new SelectItem();
         si_0.setValue("11");
         si_0.setLabel("sri");
         si_1.setValue("21");
         si_1.setLabel("ADAMS");
         existingOwners.add(si_0);
         existingOwners.add(si_1);
         logger.info("values in the list" +existingOwners.get(1).getValue());
              }catch(Exception e){
                   logger.debug(e.getCause());
                   e.printStackTrace();
              return existingOwners;
         public void setExistingOwners(List<SelectItem> existingOwners) {
              try{
              this.existingOwners = existingOwners;
              }catch(Exception e){
                   logger.debug("%%%%");
                   logger.debug(e.getCause());
                   e.printStackTrace();
    public String getSelectedOwner() {
         try{
         List<SelectItem> test = this.getExistingOwners();
         selectedOwner = (String)test.get(1).getValue();
         logger.debug("selected owner from the list" +selectedOwner);
         }catch(Exception e){
         logger.debug(e.getCause());
         e.printStackTrace();
         return selectedOwner;
         public void setSelectedOwner(String selectedOwner) {
              this.selectedOwner = selectedOwner;
    public List<SelectItem> getExistingOwners() should actually be a call to the DB to get the list.
    But since i was getting exception I tried to hard code the list in the method itself.
    But , I get this exception:
    logger.info values in the list 21
    [6/15/09 12:49:45:687 EDT] 0000003d ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /processApplication.jsp. Exception thrown : javax.servlet.ServletException: Conversion Error setting value ''{0}'' for ''{1}''.
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:658)
         at com.ibm._jsp._processApplication._jspService(_processApplication.java:149)
         at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
         at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
         at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:701)
         at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:646)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
         at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    Earlier, I had a drop down list that was working perfectly fine.
    But its values came from a Helper class and not the DB.
    What is it that Iam missing or doing wrong?
    Please help me.
    Thanks.

    Based on your example on the link that you referred to I tried to do this
    fillSelectItems();
    as the initialization block (I read what it means)
    changed my getter method to
    public List<SelectItem> getExistingOwners() { return existingOwners; }
    private void fillSelectItems() {
    this.existingOwners = new ArrayList<SelectItem>();
    try{
         existingOwners.clear();
         List test = this.getOwners();
         SelectItem[] myitem = new SelectItem[test.size()];
         for(int i=0;i<test.size();i++) {
         Object[] arrayOne = (Object[])test.get(i);
    try{
         SelectItem tmp = new SelectItem();
         tmp.setLabel(arrayOne[0].toString()+(String)arrayOne[1]);
         tmp.setValue((Integer)arrayOne[0]);
         myitem[i] = tmp;
    this.existingOwners.add(myitem);
    }catch(Exception e){
              logger.debug(e.getCause());
              e.printStackTrace();
         }catch(Exception e){
              logger.debug(e.getCause());
              e.printStackTrace();
    Basically, I moved what I had earlier in getter method I have it now in the fillSelectItems()
    Butthen, I get a NullPointerException.

  • Getting problem in binding DropDown List with table data in visual JSF

    Hi All,
    I am new to visual JSF.
    I am getting few problems while working over components.
    I have succeeded in binding data of Person table in a drop down list .
    By just drag drop ..it worked.
    But while connecting to external DB this drag drop mechanism didn't work for me .
    1st problem that i faced was by dragging method columns are not visible when i did right click-> bind to Data -> DataProvider window .
    But i am successfully printed table Data in backend ie: by putting
    for(int i=0; i<xn_white_listDataProvider.getAllRows().length;i++){
           System.out.println("  value :"+xn_white_listDataProvider.getValue("SUB_ID",xn_white_listDataProvider.getRowKey(Integer.toString(i))));
    }I am not getting how to set Items in dropdown1
    I tried putting
    HelloSh.xn_white_listDataProvider.options['XNODE.XN_WHITE_LIST.SUB_ID, XNODE.XN_WHITE_LIST.SUB_ID'but it didn't work while for person data table
      items="#{HelloSh.personDataProvider.options['PERSON.PERSONID,PERSON.NAME']}"it is working
    when i am writting items="24,28" in dropdown1 box
    & printing its value in static text Like
    <webuijsf:staticText id="staticText3" style="position: absolute; left: 72px; top: 120px" text="#{HelloSh.dropDown1.items}"/> it is printing fine .
    Plz help me in this regard.
    Any clarification if needed plz let me know.
    Thanks in advance.

    <h:selectOneMenu id="menu1" styleClass="selectOneMenu">
    <f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList}*" />
    </h:selectOneMenu>When we bind the list to the h:selectOneMenu the code in the JSP will be as given above.
    My doubts here are
    1) But when i tried to bind the list to a selectonemenu the code in the JSP is looking like this one
    <h:selectOneMenu id="menu1" styleClass="selectOneMenu">
    <f:selectItems value="*#{selectitems.pc_DynamicPortletEdit.regList.regList.toArray}*" />
    </h:selectOneMenu>2) Also in the runtime instead of displaying the values in the dropdown, i am getting the object names (javax.faces.model.SelectItem@680d0ccc) in the drop down.
    What am I doing wrong? Any help here would be usefull for me.
    BTW,
    the code in the backing bean for setting the values is like this
    List dropListValue = new ArrayList();
        for (int x=0; x<result.length; x++){ //where result is array of string values              
            SelectItem tempSelect = new SelectItem();
            tempSelect.setLabel(result[x]);
            tempSelect.setValue(result[x]);
            dropListValue.add(result[x]);                      
    this.setRegList(dropListValue );The bean is in request scope only.

  • JSF: Conversion Error setting value

    Anyone knows how to fix this? I got the following error when I tried to put 50 numbers in the dropdown list:
    javax.servlet.ServletException: "{2}" Conversion Error setting value ''{0}'' for ''{1}''.
    Here is the bean
         private String[] items=null;
         public String[] getItems() {
              items = new String[50];
              for (int i=0; i <50; i++){
                   String va = String.valueOf(i);
                   items= va;
              return items;
         public void setItems(String[] it) {
              items = it;
    Here is the tag:
    <h:selectOneMenu id="test" value="1">
         f:selectItems value="#{QuestionBean.items}"/>
    </h:selectOneMenu>

    f:selectItems value attribute must be a list of SelectItem objects.
    Transform your items list and it'll work.

  • How to use "selectOneRadio" to enable/disable a Picklist.

    Hi,
    I m new to JSF and having a requirement to enable/disable two picklists using "<h:selectOneRadio>".
    Kindly reply if anyone has done similar thing before or if any one can provide any suggestions on how to acheive this?
    Thanks in Advance!
    Vivek

    Finally,
    I found a way to get this done... I managed to get this work using JavaScript. Look for the code below.
    <script type="text/javascript">
    function enablePickList(form,radio,picklist1,picklist2)
    var radio = document.forms[form][[form+":"+radio|http://www-128.ibm.com/developerworks/forums/]][0].checked;
    if(radio)
    document.getElementById(form+":"+picklist1).disabled = false;
    document.getElementById(form+":"+picklist2).disabled = true;
    else
    if(!radio)
    document.getElementById(form+":"+picklist1).disabled = true;
    document.getElementById(form+":"+picklist2).disabled = false;
    </script>
    <h:selectOneRadio id="myRadio1"
    value="#{GLAccountDimension.enablePicklist}" onclick="enablePickList ('glaccountinsert','myRadio1','AccountLevelList1','AccountLevelList2');">
    <j:selectItem itemValue="true" itemLabel="Select">
    <h:selectOneMenu id="AccountLevelList1"
    value="#{GLAccountDimension.glAccountLevel1}"
    immediate="true" disabled="true">
    <j:selectItems value="#{GLAccountDimension.glAccountLevel1List}" />
    </h:selectOneMenu>
    </j:selectItem>
    <j:selectItem itemValue="false" itemLabel="Select">
    <h:selectOneMenu id="AccountLevelList2"
    value="#{GLAccountDimension.glAccountLevel2}"
    immediate="true" disabled="true">
    <j:selectItems value="#{GLAccountDimension.glAccountLevel2List}" />
    </h:selectOneMenu>
    </j:selectItem>
    </h:selectOneRadio>

  • Tooltip for h:selectOneMenu which uses f:selectItems to display data

    I want to display a tooltip when a user mouseovers over every element in a dropdown.
    I'm using h:selectOneMenu for displaying the dropdown          
    <h:selectOneMenu tabindex="4" id="dataList" valueChangeListener="#{DataBean.processDataSelection}" value="#{DataBean.dataSelected}" >
              <a4j:support event="onchange" reRender="dataPanel" ajaxSingle="true"/>
              <f:selectItems value="#{DataBean.dataList}" />                         
    </h:selectOneMenu>
    Can anyone give any solution?

    There is no way with the Sun JSF Mojarra. Either implement your own Javascript solution (crawl the DOM and apply title the attribute on the options), or rise a featurerequest at the issuetracker of the Mojarra [development team|http://javaserverfaces.dev.java.net] that they should add the 'title' attribute to the f:selectItem tag and the javax.faces.model.SelectItem class.

  • ItemDisabled doesnt works in f:selectItem of h:selectOneMenu

    Here is the dropdown in which itemDisabled="true" doesnt works for f:selectItem
    <h:selectOneMenu id="manufList" value="#{manufacturerBean.selectedManufacturer}" >
    <f:selectItem itemLabel="New" itemValue="New" itemDisabled="true" />
    <f:selectItems value="#{manufacturerBean.manufacturerList}" />
    <a4j:support action="#{manufacturerBean.loadManufacturerDetails}" event="onchange" reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />
    </h:selectOneMenu>
    Any pointers/suggestions will be appreciated
    Regards
    Bansi

    Forgot to mention in my earlier posting ................
    I have observed itemDisabled="true" works in Firefox browser but not in IE.
    Even in Firefox browser the item is disable only onChange i.e. pick different value form the list. I want the item to be disable as soon as the page loads
    The dropdown is the first component in my JSF page and it does CRUD operation. The first value in the dropdown is "New".
    When users pick "New" value from the dropdown it facilitates Create operation
    If users pick a value othet than "New" from the dropdown then all other fields are dynamically populated facilitating "Update" operation
    As picking "New" value from dropdown results in "Create" operation so its role based and needs to be disabled as follows
    <f:selectItem itemLabel="New" itemValue="New" itemDisabled="#{manufacturerBean.hasRole}" />
    which unfortunately doesnt work as soon as the page loads
    I am setting the value for property "hasRole" in the Constructor of backing bean as shown below
    public ManufacturerBean() {
         System.out.println("Inside Manuf Constructor");
    UserInfo userInfo = UserInfoHolder.getUserInfo();
    userRoles = userInfo.getUserRoles();
              Iterator it = userRoles .iterator();
         while (it.hasNext()) {
         // Get element
         userRole = (UserRole) it.next();
         roleName = (String) userRole.getNamsRole().getName();
         if (roleName.equals("NAMS Admin"))
              hasRole=true;
         else
              hasRole=false;
    Any pointers/suggestions will be highly appreciated
    Regards
    Bansi

Maybe you are looking for

  • Can I transfer my iWeb files to new iMac running Yosemite

    I have recently purchased a new iMac running Yosemite 10.10.2. I have a set of iWeb files that I was working on but had not yet published as a website on my old iMac which is running OS X 10.5.8. Is it possible to transfer these files to the new mac?

  • Alarm Clock - Multiple Alarms

    Maybe its me, but can anyone help me with setting up multiple alarms on the Z10. This function was a must have for me on my trusty ol' Bold running OS6, but I'm unable to find a way to add multiple alarms in OS10. Please tell me this function is avai

  • Extension Manager errors

    I've lost the ability to open my extensions manager. The error first read "extension manager in use" and after re boot now reads "could not find preferences file -created a new preferences file" but it still will not open. Also lost the ability to sy

  • ABAP-oop

    what are object oreiented concept in abap?explain each one any body can help me?

  • Working time activation

    Hi SDN experts we have ess ( erp 2004) implemented with some minimal features in place, now we want to implement working time into it, can somebody guide me interms of how to activate working time worksets and make it working. your help is much appre