selectonemenu

JSF/PrimeFaces selectOneMenu change view-id

拈花ヽ惹草 提交于 2019-12-03 08:51:22
问题 I'm using JSF2 and PrimeFaces3. How can I write selectOneMenu that would invoke JSF navigation to redirect user to another page when he change option in menu? 回答1: Attach an ajax listener and let it navigate by NavigationHandler. E.g. <h:form> <h: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" />

Navigate using p:selectOneMenu

前提是你 提交于 2019-12-03 08:19:15
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't get followed. BalusC Use custom content with <p:column> with therein a <h:link> . Bean: private List

javax.el.PropertyNotFoundException: itemLabel=“#{projet.nomProjet}”: Property 'nomProjet' not found on type java.lang.String

亡梦爱人 提交于 2019-12-02 20:11:54
问题 I'm trying to apply a JSF converter to an Entity inside a selectOneMenu, but the converter is not recognized, I get this warning in my xhtml file, <<"nomProjet" cannot be resolved>> and when I run the application I'm getting Error HTTP 500 : itemLabel="#{projet.nomProjet}": Property 'nomProjet' not found on type java.lang.String Here is my code: The selectOneMenu in my view <p:selectOneMenu id="projet" converter="projetConverter" value="# {affectation.selectedProjet}" > <f:selectItems var=

JSF converter for selectOneMenu

99封情书 提交于 2019-12-02 18:12:10
问题 I want to set a many-to-one relationship in a hibernate entity using selectOneMenu . <h:selectOneMenu value="#{taskBean.instance.currency}" class="form-control" id="currencyList" converter="#{currencyConverterBean}"> <f:selectItems value="#{currencyBean.currencyList}" var="currency" itemLabel="#{currency.name}"/> </h:selectOneMenu> where #{taskBean.instance} returns a hibernate entity Task: @Entity @Table(name="task") public class Task { //... public Currency currency; @ManyToOne @JoinColumn

how to get value from <h:selectOneMenu>?

不想你离开。 提交于 2019-12-02 13:16:23
问题 i want to get the value from . i tryed this code but it doesn't work : <h:form> <h:outputLabel value="départements : "/> <h:selectOneMenu value="#{departementController.selected.id}" onchange="submit()" immediate="true"> <f:valueChangeListener type="Controller.Listener.DepartementValueListener"/> <f:selectItems value="#{departementController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:outputLabel value="nouvelle valeur : "/> <h:inputText value="#{departementController.comboBox}" id="dep

JSF converter for selectOneMenu

十年热恋 提交于 2019-12-02 09:26:15
I want to set a many-to-one relationship in a hibernate entity using selectOneMenu . <h:selectOneMenu value="#{taskBean.instance.currency}" class="form-control" id="currencyList" converter="#{currencyConverterBean}"> <f:selectItems value="#{currencyBean.currencyList}" var="currency" itemLabel="#{currency.name}"/> </h:selectOneMenu> where #{taskBean.instance} returns a hibernate entity Task: @Entity @Table(name="task") public class Task { //... public Currency currency; @ManyToOne @JoinColumn(name = "currencyID") public Currency getCurrency() { return currency; } //... } If one sets value #

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

不想你离开。 提交于 2019-12-02 04:26:43
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 javax.faces.convert.FacesConverter; @FacesConverter(value = "dateAndTimeconverter") @ManagedBean public

how to get value from <h:selectOneMenu>?

不想你离开。 提交于 2019-12-02 03:26:08
i want to get the value from . i tryed this code but it doesn't work : <h:form> <h:outputLabel value="départements : "/> <h:selectOneMenu value="#{departementController.selected.id}" onchange="submit()" immediate="true"> <f:valueChangeListener type="Controller.Listener.DepartementValueListener"/> <f:selectItems value="#{departementController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:outputLabel value="nouvelle valeur : "/> <h:inputText value="#{departementController.comboBox}" id="dep"/> </h:form> the controller : //departement change listener private String comboBox; public String

Pick Custom Object from Select one menu JSF [duplicate]

会有一股神秘感。 提交于 2019-12-02 03:08:51
This question already has an answer here: How to populate options of h:selectOneMenu from database? 5 answers 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}" var="currency" itemValue="#{currency.currencyId}" itemLabel="#{currency.currencyName}" > </f:selectItems> <p:ajax update=

Bold second item of a selectOneMenu

天大地大妈咪最大 提交于 2019-12-02 02:14:08
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> The HTML <option> element as generated by <f:selectItems> allows for very little fine-grained styling and the CSS support is browser-dependent. You could use the CSS3 :nth-child pseudoselector. E.g. <h:selectOneMenu