Integrating pickList and selectOneMenu. Help !!

UI Components for JSF
Post Reply
User avatar
daniel.todt
Posts: 5
Joined: 29 Jan 2011, 17:31
Location: Brazil

10 May 2011, 16:50

Hello my name is Daniel, and I'm trying to populate a h:selectOneMenu with the target list from a p:pickList.

The image below shows the listing contained in the h:selectOneMenu before adding the value "Espanhol" to target list
Image
By danieltodt at 2011-05-10

The "problem" is, when the target list is changed, the selectOneMenu is not changed.

Could be the p:selectOneMenu of version 3.0, is better than the h:selectOneMenu I'm using for solve my problem?
Could someone give me a quick explanation of how to solve this problem?

Forgive my bad English is not my native language.

Thanks Daniel.

P.S. System specification:
S.O: Linux
IDE: Netbeans 7.0
Primefaces version: 2.2.1
JSF: 2.0 w/ Annotations
DB: MySql w/ Hibernate 3.6 and Annotations
Last edited by daniel.todt on 11 May 2011, 00:25, edited 2 times in total.

User avatar
daniel.todt
Posts: 5
Joined: 29 Jan 2011, 17:31
Location: Brazil

10 May 2011, 19:35

Adding some information.

I have tested my application with the new component p:selectOneMenu from the new version of primefaces, and it broke the xhtml file with the message "Opening and ending tag mismatch: tbody line 0 and table".

I'm using the sample of the p:selectOneMenu obtained from the Primefaces showcase.
Look to the code below (modulo.xhtml).

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<ui:composition 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"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="/templates/interno.xhtml">

    <ui:define name="tituloConteudoInterface">
        <h:outputText value="Módulos"/>
    </ui:define>

    <ui:define name="conteudoInterface">
        <h:form prependId="false">
            <p:commandLink update="formDialogo" oncomplete="dialogGerencia.show()" value="Novo" title="Novo Módulo" actionListener="#{moduloBean.prepararAdicionarModulo}" />
        </h:form>
        <h:form id="formListagem" prependId="false">
            <p:dataTable id="tabelaModulos" var="modulo" value="#{moduloBean.listaModulos}" emptyMessage="Nenhum Módulo encontrado" style="width: 100%">
                ...
            </p:dataTable>
        </h:form>
    </ui:define>

    <ui:define name="dialogoInterface">
        <p:dialog header="Módulo" widgetVar="dialogGerencia" resizable="false" modal="true" width="500" closeListener="#{moduloBean.limparModulo}">
            <h:form id="formDialogo" prependId="false">
                ...                
                <p:pickList value="#{idiomaModuloBean.idiomasModulo}" var="idioma" iconOnly="true"
                            itemLabel="#{idioma.nome}" itemValue="#{idioma}" converter="idiomaConverter"
                            addLabel="Adicionar"
                            addAllLabel="Adicionar Todos"
                            removeLabel="Remover"
                            removeAllLabel="Remover Todos">
                    <f:facet name="sourceCaption">
                        <h:outputText value="Idiomas Disponiveis"/>
                    </f:facet>
                    <f:facet name="targetCaption">
                        <h:outputText value="Idiomas Traduzidos"/>
                    </f:facet>
                </p:pickList>

                <h:panelGrid id="idiomasTraduzidos" columns="2" cellpadding="5" style="margin-bottom:10px; margin-top:10px">
                    <h:outputLabel value="Idioma Padrão:"/>
                    <p:selectOneMenu value="#{idiomaModuloBean.idiomaPadrao}" effect="fade" converter="idiomaConverter" var="id">
                        <f:selectItem noSelectionOption="true" itemLabel="Selecione" itemValue=""/>
                        <f:selectItems value="#{idiomaModuloBean.idiomasModulo.target}" var="idioma"
                                       itemValue="#{idioma}" itemLabel="#{idioma.nome}"/>
                        <p:column>
                            #{id.nome}
                        </p:column>
                    </p:selectOneMenu>
                </h:panelGrid>

                <p:commandButton update="formDialogo, formListagem" oncomplete="dialogGerencia.hide()" actionListener="#{moduloBean.salvarModulo}" value="Salvar"/>
                <p:commandButton oncomplete="dialogGerencia.hide()" value="Cancelar"/>
            </h:form>
        </p:dialog>
    </ui:define>
</ui:composition>
Without the p:selectOneMenu part, the code works great.

Any idea of what it can be?

Forgive my bad English is not my native language.

Thanks Daniel.

P.S. System specification:
S.O: Linux
IDE: Netbeans 7.0
Primefaces version: 3.0 M1 Temporarily
JSF: 2.0 w/ Annotations
DB: MySql w/ Hibernate 3.6 and Annotations

Genmutant
Posts: 1
Joined: 27 Jun 2011, 14:36

27 Jun 2011, 14:53

I have the same problem with 3.0 M1 and the 3.0 M2 nightly. It seems there's no </tbody> tag, but an <tbody> start tag instead.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests