selectonemenu

How to add tooltip to f:selectItems

流过昼夜 提交于 2019-11-26 09:57:00
问题 For example the f:selectItems component doesn\'t support the title attribute in some versions of JSF. Would it be possible to replace JSF Components by their plain HTML counterparts using JSFC and do something like this? <select jsfc=\"h:selectOneMenu\" value=\"#{cc.data}\"> <option jsfc=\"f:selectItems\" value=\"${cc.listItems}\" var=\"item\" title=\"#{item.tooltip}\"></option> </select> instead of <h:selectOneMenu value=\"#{cc.data}\"> <f:selectItems value=\"#{cc.listItems}\" /> </h

Using a “Please select” f:selectItem with null/empty value inside a p:selectOneMenu

走远了吗. 提交于 2019-11-26 08:23:15
问题 I\'m populating a <p:selectOneMenu/> from database as follows. <p:selectOneMenu id=\"cmbCountry\" value=\"#{bean.country}\" required=\"true\" converter=\"#{countryConverter}\"> <f:selectItem itemLabel=\"Select\" itemValue=\"#{null}\"/> <f:selectItems var=\"country\" value=\"#{bean.countries}\" itemLabel=\"#{country.countryName}\" itemValue=\"#{country}\"/> <p:ajax update=\"anotherMenu\" listener=/> </p:selectOneMenu> <p:message for=\"cmbCountry\"/> The default selected option, when this page

Make multiple dependent / cascading selectOneMenu dropdown lists in JSF

一世执手 提交于 2019-11-26 04:27:07
问题 I am trying to make 4 dependent menus. When the user chooses an item from the first menu, the second menu will show dependent data and when the user chooses item from the second one , the third one will show dependent data and so on. The user will see items on the first menu only and the other ones will be blank. If he chooses an item on the first menu the second one will show data but the third and the fourth will remain blank, and so on. The user must eventually choose entries from all the

How to load and display dependent h:selectOneMenu on change of a h:selectOneMenu

会有一股神秘感。 提交于 2019-11-26 02:38:44
问题 I want to create JSF registration form which has select menu with the list of all countries. I know that this is easy for implementation with Java HashMap but the tricky part that I don\'t know how to implement is how right after the user selects his country from the list, second select menu to appear with the cities in his country? Is there any useful example? Best wishes. 回答1: You can use <f:ajax> for this. When nested in an input component such as <h:selectOneMenu> , then it will by

How to use enum values in f:selectItem(s)

社会主义新天地 提交于 2019-11-26 00:57:57
问题 I want to make a selectOneMenu dropdown so I can select a status on my question. Is it possible to make the f:selectItem more flexible considering what happens if the order of the enums changes, and if the list was large? And could I do this better? And is it possible to automatically \"select\" the item that the question have? Enum class public enum Status { SUBMITTED, REJECTED, APPROVED } Question entity @Enumerated(EnumType.STRING) private Status status; JSF <div class=\"field\"> <h

Best way to add a “nothing selected” option to a selectOneMenu in JSF

会有一股神秘感。 提交于 2019-11-26 00:33:44
问题 I was wondering what would be the best or easiest way to allow a user to select nothing in a selectOneMenu. My example: I have a list of registered users and the administrator should be able to filter the list of displayed users by some criterias. These criterias, like the usertype (employee, customer, ...) can be chosen by selectOneMenus, like this: <h:selectOneMenu value=\"#{myBean.selectedUsertype}\" converter=\"#{usertypeConverter}\"> <f:selectItems value={myBean.usertypes}\" /> </h

How to use enum values in f:selectItem(s)

喜欢而已 提交于 2019-11-26 00:20:58
I want to make a selectOneMenu dropdown so I can select a status on my question. Is it possible to make the f:selectItem more flexible considering what happens if the order of the enums changes, and if the list was large? And could I do this better? And is it possible to automatically "select" the item that the question have? Enum class public enum Status { SUBMITTED, REJECTED, APPROVED } Question entity @Enumerated(EnumType.STRING) private Status status; JSF <div class="field"> <h:outputLabel for="questionStatus" value="Status" /> <h:selectOneMenu id="questionStatus" value="#{bean.question

How to populate options of h:selectOneMenu from database?

大兔子大兔子 提交于 2019-11-25 22:54:39
问题 I am creating a web application, where you have to read a list of objects / entities from a DB and populate it in a JSF <h:selectOneMenu> . I am unable to code this. Can someone show me how to do it? I know how to get a List<User> from the DB. What I need to know is, how to populate this list in a <h:selectOneMenu> . <h:selectOneMenu value=\"#{bean.name}\"> ...? </h:selectOneMenu> 回答1: Based on your question history, you're using JSF 2.x. So, here's a JSF 2.x targeted answer. In JSF 1.x you

Conversion Error setting value for &#39;null Converter&#39; - Why do I need a Converter in JSF?

白昼怎懂夜的黑 提交于 2019-11-25 21:50:37
问题 I have problems understanding how to use selection in JSF 2 with POJO/entity effectively. For example, I\'m trying to select a Warehouse entity via the below dropdown: <h:selectOneMenu value=\"#{bean.selectedWarehouse}\"> <f:selectItem itemLabel=\"Choose one ..\" itemValue=\"#{null}\" /> <f:selectItems value=\"#{bean.availableWarehouses}\" /> </h:selectOneMenu> And the below managed bean: @Named @ViewScoped public class Bean { private Warehouse selectedWarehouse; private List<SelectItem>

Validation Error: Value is not valid

泪湿孤枕 提交于 2019-11-25 21:38:05
问题 I have a problem with a p:selectOneMenu, no matter what I do I cannot get JSF to call the setter on the JPA entity. JSF validation fails with this message: form:location: Validation Error: Value is not valid I have this working on several other class of the same type (ie, join table classes) but cannot for the life of me get this one working. If anyone can throw some troubleshooting/debugging tips for this sort of problem it would be greatly appreciated. Using log statements I have verified