selectonemenu

<h:selectOneMenu> value change listener invoked for all dropdowns instead of only the current

限于喜欢 提交于 2019-12-22 11:08:18
问题 I'm using MyFaces 1.1. I have two <h:selectOneMenu> s dropdowns which each point to same valueChangeListener method. <h:selectOneMenu id="d1" value="#{mybean.selectedChannel1}" onchange="submit()" valueChangeListener="#{myform.channelValuechange}"> <f:selectItems value="#{mybean.channelList}"/> </h:selectOneMenu> <h:selectOneMenu id="d2" value="#{mybean.selectedChannel2}" onchange="submit()" valueChangeListener="#{myform.channelValuechange}"> <f:selectItems value="#{mybean.channelList}"/> </h

JSF 2.0 - selectOneMenu defaults to 0 when empty

风格不统一 提交于 2019-12-21 05:56:29
问题 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 shall store the ID ( Long ) from a different DB Table (named fk_ID) for which a constrain is in place. So far everything seems to function as planned. Now to my problem: The column fk_ID is optional, so the first option in the combobox is a f:selectItem with no value labeled "choose ...". When I save the

Navigate using p:selectOneMenu

无人久伴 提交于 2019-12-21 02:31:39
问题 I'm using a select one menu to do navigation to different parts of my site: <p:selectOneMenu value="#{navigator.outcome}"> <f:selectItem itemLabel="Select page..." /> <f:selectItem itemValue="page1" itemLabel="Page 1" /> <f:selectItem itemValue="page2" itemLabel="Page 2" /> <f:selectItem itemValue="page3" itemLabel="Page 3" /> <p:ajax event="change" listener="#{navigator.navigate}" /> </p:selectOneMenu> Is there a more SEO friendly way of doing this? I'm worried that the JavaScript links won

Navigate using p:selectOneMenu

喜欢而已 提交于 2019-12-21 02:31:09
问题 I'm using a select one menu to do navigation to different parts of my site: <p:selectOneMenu value="#{navigator.outcome}"> <f:selectItem itemLabel="Select page..." /> <f:selectItem itemValue="page1" itemLabel="Page 1" /> <f:selectItem itemValue="page2" itemLabel="Page 2" /> <f:selectItem itemValue="page3" itemLabel="Page 3" /> <p:ajax event="change" listener="#{navigator.navigate}" /> </p:selectOneMenu> Is there a more SEO friendly way of doing this? I'm worried that the JavaScript links won

Format date in <f:selectItem(s) itemLabel> using DateTimeConverter

我的未来我决定 提交于 2019-12-20 04:58:34
问题 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 a converter that extends javax.faces.convert.DateTimeConverter and change the fields in the constructor. But my dates only show in default format :( DateAndTimeConverter.java import javax.faces.bean.ManagedBean; import javax.faces.convert.Converter; import javax.faces.convert.DateTimeConverter; import

Pick Custom Object from Select one menu JSF [duplicate]

独自空忆成欢 提交于 2019-12-20 04:23:45
问题 This question already has answers here : How to populate options of h:selectOneMenu from database? (5 answers) Closed 3 years ago . I want to pick a custom object from select one menu. It neither shows an error nor values. What should I do? My xhtml document: <h:panelGrid columns="2"> <p:outputLabel value="" /> <p:selectOneMenu id="CurrencyMenu" value="#{CurrencyMB.currency}" > <f:selectItem itemLabel="-- Select Currency--" itemValue="#{null}"/> <f:selectItems value="#{CurrencyMB.currencyList

Bold second item of a selectOneMenu

对着背影说爱祢 提交于 2019-12-20 02:59:22
问题 I've got a selectOneMenu which has all cities of a state. I've made a sql to bring capital in first place, but i'd like to bold it to make it more visible to who is using it. Is there a way to bold it or to do something else to make more visible just the second option? <h:selectOneMenu value="#{someBean.cityId}"> <f:selectItems value="#{addressBean.stateList}" /> </h:selectOneMenu> 回答1: The HTML <option> element as generated by <f:selectItems> allows for very little fine-grained styling and

Skip validation conditionally, when empty f:selectItem in p/h:selectOneMenu is selected

我怕爱的太早我们不能终老 提交于 2019-12-20 02:52:44
问题 Parents : <p:selectOneMenu id="parentList" value="#{bean.selectedParent}" converter="#{parentConverter}" required="true"> <f:selectItem itemLabel="Select" itemValue="#{null}"/> <f:selectItems var="parent" value="#{bean.parentList}" itemLabel="#{parent.parentName}" itemValue="#{parent}"/> <p:ajax update="childrenList" listener="#{bean.setchildren}"/> </p:selectOneMenu> Children : <p:selectOneMenu id="childrenList" value="#{bean.selectedchild}" converter="#{childConverter}" required="true"> <f

hideNoSelectionOption in selectOneMenu is not working as expected

旧时模样 提交于 2019-12-19 11:54:23
问题 I have the following selectOneMenu and within of my component I want to have an item which shouldn't be shown, for e.g. in cases where the value from #{Mybean.value} match a value from #{Mybean.ListValues} I don't want to have an empty option in my combo box . <p:selectOneMenu value="#{Mybean.value}" hideNoSelectionOption="true" required="true" requiredMessage="Required data"> <f:selectItem itemLabel="" itemValue="#{null}" noSelectionOption="true" /> <f:selectItems value="#{Mybean.ListValues}

hideNoSelectionOption in selectOneMenu is not working as expected

瘦欲@ 提交于 2019-12-19 11:54:09
问题 I have the following selectOneMenu and within of my component I want to have an item which shouldn't be shown, for e.g. in cases where the value from #{Mybean.value} match a value from #{Mybean.ListValues} I don't want to have an empty option in my combo box . <p:selectOneMenu value="#{Mybean.value}" hideNoSelectionOption="true" required="true" requiredMessage="Required data"> <f:selectItem itemLabel="" itemValue="#{null}" noSelectionOption="true" /> <f:selectItems value="#{Mybean.ListValues}