selectonemenu 1 « Control « JSF Q&A

1. How to change the list in a SelectOneMenu, if the value is changed in another?

I want to change the SelectItem[] array in the second SelectOneMenu, if the value is changed in the first one. Is that possible? Thanks in advance!

2. JSF selectOneMenu selectItem always null

I'm trying to implement a JSF selectOneMenu item with a backing bean holding the selection. The problem is that the selectedItem is always null. Here is the code: .xhtml:


3. JSF 2 DateTimeConverter on selectOneMenu with selectItems

I have a <h:selectOneMenu> that has <f:selectItems> with CategoryHistory objects loaded in it. I only show the Date date field as itemLabel. That works but I want to format the date: I created ...

4. SelectOneMenu + CommmandButton

Hi I have the follonwing selectOneMenu

<h:selectOneMenu value="#{modelsController.selected.idBrands}">
    <f:selectItems value="{brandsController.itemsAvailableSelectOne}" />
</h:selectOneMenu> <br/>
which is populated with all available brands in the bean. ...

5. How to limit the number of item shown in ?

How can we limit the size of h:selectonemenu to show suppose 10 values. In our application we have a drop down which has more then 100 values.

6. How to make two JSF selectOneMenu that depend on each other?

I have two instances of selectOneMenu, one dependent on the other. But my processValueChange in the bean is never invoked. JSP portion:

<h:selectOneMenu id="slaPeriod" onchange="submit()" required="true"> 
  <f:selectItems value="#{LoginForm.periodList}"/>
  <f:valueChangeListener ...

7. selectOneMenu with selectItems

I am trying to make a filter using selectOneMenu. I have two categories, when one is selectect, must filter the results shown, and also the second category. JSF code:

<div id="box-categories" class="box-left">

8. JSF ValueChangeEvent: how do I change the options on one SelectOneMenu based on my selection on a previous SelectOneMenu?

Ok I've been stuck with this for a couple of days (understatement). Say I have a selectOneMenu

    <h:selectOneMenu id="selectFamily" 

9. JSF2: selectOneMenu with custom selectItems: all items are selected

Thanks to some great articles here, I've been able to build a <h:selectOneMenu /> with selectItems containing objects. After providing a custom FacesConverter and fixing the missing equals()/hashcode() methods, I am ...

10. JSF 2 : noSelectionOption problem for selectOneMenu with converter

Im currently testing the use of f:selectItems tag that make use of existing POJO classes.

This is working fine :

facelet :
<h:selectOneMenu value="#{selectionLabBean.oneSelectMenuPojo}" 
    <f:selectItems value="#{selectionLabBean.heroList}" ...

11. JSF 2.0 How to display a diferent h:panelGroup each time an item is selected from a selectOneMenu

I have a selectOneMenu that displays some diferent stuff categories:

<h:selectOneMenu value="#{searchController.selectedCategory}">
        <f:selectItems value="#{searchController.formatedCategories()}" >           ...

12.  with temporary disabled SelectItems

I have a <h:selectOneMenu> that renders the value of the cardStatus from my object model. A CardStatus has an boolean attribute 'temporaryDisabled' that means that the value is still valid but should ...

13. JSF: default selection for `` within ``

How to make default selection for <f:selectItem> within <h:selectOneMenu>? It's needed,that particular "20" item of dropdown to be already selected when page is loaded.

  <h:selectOneMenu value="#{fileSearchCriteriaOut.recordsPerPage}"  >    ...

14. Mutual exclusive jsf selectOneMenu items

Suppose I have two selectOneMenu tags bound to two different lists (let's say Products and Departments). I want to prevent choosing some Departments depending on the Product selected and vice versa. Where ...

15. JSF2 enum h:selectOneMenu

I'm trying to use an enum with a h:selectOneMenu box in a JSF2 project. What I've got so far: Enum:

public enum MyType {
  ME;       ...

16. JSF h:SelectOneMenu does not convert to Number

I am using Sun JSF-RI 1.2 and having grief with h:SelectOneMenu. The value is bound to a backing bean field of type Object.

<h:selectOneMenu value="#{bean.currentNumber}">
  <f:selectItems value="#{bean.numberList}" />
The SelectItems are created ...

17. How to set default value to

I am trying to set default value to h:selectOneMenu. But, It is not working. This is my code index.xhtml

        <h:form id="test">

18. Ajax support In h:selectOneMenu

I have to call backend code as soon as one value is selected from drop-down list. I am using JSF 2.0. In JSF 1.2 I did it by using <a4j:support> in ...

19. jsf h:selectonemenu problem

I am developing a jsf,richfaces application.where i want to populate the values of second select menu on the basis of selecting the choice from the first one .i have achieved this ...

20. How to fill selectonemenu JSF

I want to fill an selectonemenu from my data base , but always the list is empty this is my code:

public ArrayList<String> FindListKpi(Integer userid)
  ArrayList<String> usrpr=new ArrayList<String>();


21. t:selectOneMenu how to get selected value using java script?

i want to get the select one menu using java script how can i get the selecteditem value?

<h:outputLabel value="#{l.description1}" styleClass="dataValue" />
<t:selectOneMenu id="chooseLevelTypeId"
    <f:selectItem ...

22. How to use h:selectOneMenu in f:selectItem?

    <h:selectOneRadio id="profiles" layout="pageDirection" value="#{bean.selectedProfile}" style="font-size:12px;">

       <f:selectItem itemValue="0" itemLabel="#{messages.msg_profile1} ">
          <h:selectOneMenu id="countries" value="#{bean.selectedCountry}" ...

23. How to avoid / suppress JSF null (no selection option) tab?

When creating a new item the user does not want to see the null no selection option in the Select-One Menu, but directly an item from the available items. So either ...

24. -- display an option in different color

I have a piece of code

<h:selectOneMenu id="addStream" value="#{streamManager.selectedStreamID}"> 
<f:selectItems value="#{streamManager.streamList}" var="stream"  /> 
StreamList is the list of all the streams. In a stream bean I have a boolean attribute ...

25. Populating ListBox onLoad JSF

I am using netbeans 6.9.1 Glassfish 3. I have a JSF file, and there is a selectOneMenu listbox on it. this list box will be populated with values from the DB. ...

26. Get the value that has been selected in the selectOneMenu ListBox

This is how my JSF looks like.

  <h:selectOneMenu value="#{HotelDataForm.listHotel}">
           <f:selectItems value="#{HotelDataForm.listHotel}" var="user" itemValue="#{user[1]}" itemLabel="#{user[1]}" />

27. Why selectOneMenu Send ItemLabel to the converter?

my JSF page

   <h:selectOneMenu id="studlist" value="#{studBean.selectedStudent}">                   

28. How to show required message of h:selectOneMenu with a default select option?

I am facing one issue with selectOneMenu. I need to display list of items in a drop down and it is a required field. In that drop down the ...

29. jsf noSelectionLabel ln selectOneMenu

How to provide an noSelectionLabel in selectOneMenu with converter? Using noSelectionLabel in selectItem throus a NullPointerException in converter class.

30. Make jsf selectOneMenu open upwards

I have a selectOneMenu at the bottom of my page and by default when I click it the menu drops below the bottom of the page. Is there a way ...

31. Does required on selectOneMenu only accept true?

I have this selectOneMenu that asks for something, the default value is empty, because people need to think about the question and actually needs to fill it in.

<h:selectOneMenu id="fileSecurity" value="#{flowScope.application.fileSecurity}" required="true" ...

32. Why doesn't my f:ajax work with h:selectOneMenu?

Using JSF 2.0, Glassfish 3.2, Primefaces 2.2.1 I have a page with several composite components. In one of these components, I have an h:selectOneMenu. I am trying to add f:ajax ...

33. JSF selectOneMenu value not set

I have a page where a SelectOneMenu is rendered whether there is some info on DB or not. My form looks like this:

<h:form id="wrapperUpload" enctype="multipart/form-data" >
<h:outputLabel for="option" value="Tipo de carga: "

34. JSF 2.0 - selectOneMenu defaults to 0 when empty

For my project i want to implement a combobox with h:selectOneMenu. I read many posts about how to handle the selectOneMenu properly and how to implement a custom converter. The combobox ...

35. How to add a scrollbar to h:selectOneMenu?

I have created a JSF Facelets document. In that document, I am working with dropdown list using <h:selectOneMenu> tag. How can I add a scrollbar to this dropdown menu and after ...

36. JSF Converter and h:selectOneMenu

37. h:selectOneMenu problem

38. Question with selectOneMenu

39. SelectOneMenu problem

40. Cannot set a value in selectOneMenu

Does anyone have a working snippet they can share on this? I've been hacking on this for some time, but no luck. Here's what I want to do. I have a selectOneMenu that I wish to populate from a database. I get the values fine. However, I can't seem to set the selected item in that dropdown. It always defaults to ...

41. selectOneMenu disabled

Hi, I have dropdown menu on my page which gets value from a bean. I also have a checkbox which if not selected disables the dropdown menu. I do that using javascript. Now when I submit the form (when dropdown menu is disabled) bean throws null pointer exception for dropdown menu property. I donot want to get this exception when my ...

42. selectOneMenu

43. problems with <h:selectOneMenu>

44. how to use "h:selectOneMenu"

45. selectOneMenu

hi all , here is my situation ! i have 2 pages Test1.jsp and Test2.jsp Test1 has a submit button and it populates an arrayList in managed bean and takes me to Test2.jsp. Test2.jsp has one inputText component , selectoneMenu component and a submit button. The inputText component is a required field, so i have the validator for that. My issue ...

46. Editable SelectOneMenu

47. Selecting an item using selectOneMenu

48. Null first value in a SelectOneMenu

51. selectOneMenu and custom converter

54. Help me with SelectOneMenu

57. Problems with selectonemenu

I've been trying to get selectonemenu to work but no success so far. I have a "sale" and a "car" bean, and car is an atribute for sale. All the classe are very simple and clear, with all thet gets and sets on the spot. On my "New sale" jsp I display all the car options on a selectonemeu. So far ...

58. selectOneMenu width

59. selectOneMenu problem

60. trouble getting value of selectOneMenu

Hi experts, I am having trouble receiving a select box's value at the back end. My requirement is that the user can search a person on the basis of userid ( uid) or last name or id, so I created a select box ( searchTypeSelect) for that. now the user specifies the keyword in a text box and on the basis ...

61. How to get selectOneMenu value

Well, the selectOneMenu value is accessible by endpoint.protocol. If you don't understand how it works, here is a basic working example: JSF MyBeanprivate String selectedItem; public String getSelectedItem() { if (selectedItem == null) { selectedItem = "value2"; // This will be the default selected item. } return selectedItem; } public void setSelectedItem(String selectedItem) { this.selectedItem = ...

62. Trouble using Map with h:selectOneMenu...

I have the book "Core JavaServer Faces" and in there it says that I can use a plain Map collection with selectItems in a selectOneMenu. I'm able to get it to work on one app but not another...using the same JSF implementation on the same app naturally I'm completely say the least. I'm using Sun's Glassfish V1 and the ...

63. selectOneMenu

I need to get to the selected items ID value, as apposed to the actual value, because I use this reference to look up something in the DB, and its not clear from the API how to get to this. Binding to the value is no problem, but this is not neccessary unique in the database. Do I need to bind ...

64. h:selectOneMenu - setting the correct value

public javax.faces.model.SelectItem[] getAssignedTos() { SelectItem[] select = null; try { List employeeList = new ArrayList(); Employee employee = null; employee = new Employee(); employee.setEmployeeId(1); employee.setEmployeeName("Paul Timothy"); employeeList.add(employee); employee = new Employee(); employee.setEmployeeId(2); employee.setEmployeeName("RC Toribio"); employeeList.add(employee); select = new SelectItem[employeeList.size()]; int i = 0; for (Employee e : employeeList) { select[i++] = new SelectItem(e); } } catch(Exception ex) { ex.printStackTrace(); } return ...

65. Problem With selectOneMenu

66. Problem with selectOneMenu

I have two selectOneMenu . One is populated based on the selected value of the first, that is the first has onselect="submit()" that is once you select a value the form reloads and the second selectOneMenu loads up vaules from the database, Problem is it works until i set "required=true" on other form objects on the same page. seems the page ...

68. selectOneMenu

69. Problems using h:selectOneMenu

70. JSF selectOneMenu

71. Dynamic selectOneMenu

72. data table + selectOneMenu

73. Problem in h:selectOneMenu

74. Problem in h:selectOneMenu

81. JSF Problem with ...

Hi Friends, First of all i would like to thankyou all for your previous valuable suggestions. I got stucked up with a problem. I have a dropdown list in which i have only 2 values 'Remodeling' and 'New'. When the user selects the option 'Remodeling' , i need to render a group of checkboxes.I tried lot many ways but didn't work. ...

83. Getting Selection from selectOneMenu

84. Editable SelectOneMenu list box

87. JSF h:selectOneMenu concern

Smitha, I successfully retreive from DataBase and display loggedUserProjects: see ------------------------------------- ------------------------------------- For persisting ProjectReport to DataBase I need projectName (other fields, i.e. projectStatus etc are commented now). When I press "Submit" button in browser, JSF MUST initialize the binded #{SubmitReport.projectName} projectName field of SubmitReport bean and INITIALIZE IT with selected value (if I ...

89. i am facing some problem with

Hi Guys, I am facing some problem with 1. Click on Command button Without selecting any fileds validations messages are coming. 2. When i select USA in selectOneMenu and click ...

90. SelectOneMenu value Not getting reset

91. h:selectOneMenu Issue Problem in JSF1.2

92. Passing param into h:selectOneMenu

93. how to edit

94. choose from SelectOneMenu, get the result in a SelectOneMenu

I have a similar problem: I need to know, in my back manage bean, what is the selected item. My selectOneMenu is created dynamically from a database query. By now I dont have the answer yet. I think the idea of Akaine is interesting Run a javascript function on onchange or onselect event that compares the values and set the selected ...

96. selectOneMenu VCL not firing

Hi, I have a problem with selectOneMenu VCL. I have 2 drop downs if we select value in first dropdown we have to get consequte values in second dropdown.

97. SelectOneMenu not displaying uniformly

99. h:selectOneMenu and s:selectItems

100. Populate a SelectOneMenu and others

i, i'm here to ask to you something to my "web project".. i'm italian so sorry for my english! I'm using JSF and Hibernate for the database... i create POJO and DAO classes from database and do a .xhml page with the information that the user have to write like this: now the ...