Note that there are some explanatory texts on larger screens.

plurals
  1. POh:selectOneMenu default value issue when put it in h:dataTable
    primarykey
    data
    text
    <p>I have a problem with <code>h:selectOneMenu</code>. If I put it in <code>h:dataTable</code> I'm unable to set the default value. This is the code:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; &lt;ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;h:dataTable value="#{utenteBean.listaUtenti}" var="utente" &gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="1"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{sW.headerUsername}" /&gt; &lt;/f:facet&gt; &lt;h:outputText escape="false" value="#{utente.username}"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{sW.headerEnabled}" /&gt; &lt;/f:facet&gt; &lt;h:form&gt; &lt;h:commandLink action="#{utenteBean.updateAbilitato}"&gt; &lt;h:outputText value="#{utente.enabled}"&gt; &lt;f:converter converterId="abilitatoConverter"/&gt; &lt;/h:outputText&gt; &lt;f:setPropertyActionListener target="#{utenteBean.utente}" value="#{utente}"/&gt; &lt;/h:commandLink&gt; &lt;/h:form&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{sW.headerRuolo}" /&gt; &lt;/f:facet&gt; &lt;h:form&gt; &lt;h:selectOneMenu value="ROLE_ADMIN" valueChangeListener="#{utenteBean.updateRuolo}"&gt; &lt;f:selectItem itemLabel="Utente" itemValue="ROLE_USER"/&gt; &lt;f:selectItem itemLabel="Admin" itemValue="ROLE_ADMIN"/&gt; &lt;/h:selectOneMenu&gt; &lt;/h:form&gt; &lt;/h:panelGroup&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; &lt;/ui:component&gt; </code></pre> <p>If I move the <code>h:form</code> with <code>selectOneMenu</code> out of <code>h:dataTable</code> all works. I'm using jsf2.0 on glassfish3</p> <p>Any Ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload