panelGrid不显示在对话框内



我的问题既简单又困难。

我想在我的p:dialog里面显示一些信息。所以我用面板网格来做。但是它没有显示信息,我不知道为什么。这是我的页面和bean的代码;)

(我使用的是PrimeFaces 4.0, Mojara 2.1.6)

MessageBean

 package ma.corporate.bean;
    import java.io.Serializable;
    import java.util.List;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import ma.corporate.facade.MessageFacade;
    import ma.corporate.model.Message;
    @ManagedBean(name = "messageBean")
    @SessionScoped
    public class MessageBean implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private MessageFacade messageFacade;
    private List<Message> messages;
    private Message message;
    private static int cpt=0;
    //private Message message2;
    public MessageBean() {
        // messageFacade = new MessageFacade();
        // messages = messageFacade.Lister();
        /*
         * if(messages==null) System.out.println("null"); else
         * System.out.println(messages.get(0).getTextMessage());
         */
        //message2=new Message();
        message = new Message();
        cpt++;
    }
    public List<Message> getMessages() {
        // messages = messageFacade.Lister();
        messageFacade = new MessageFacade();
        messages = messageFacade.Lister();
        return messages;
    }
    public void setMessages(List<Message> messages) {
        this.messages = messages;
    }
    public Message getMessage() {
        return message;
    }
    public void setMessage(Message message) {
        this.message = message;
    }
    public void save() {
        messageFacade.enregistrer(message);
    }
    public void Supprimer(Message message) {
        messageFacade.supprimer(message);
        messages = messageFacade.Lister();
    }
    public void init(Message message) {
        //this.message.setEmail("aaaaaaaaaaaaaa");
        //this.message.setNomComplet("bbbbbbbbbbbbbbbb");
        //this.message.setTelephone("343232");
        this.message = message;
        System.out.println(this.message.getNomComplet());
        System.out.println(cpt);
    }
}

我不能使我的html页面的代码,因为一个错误,当我想要发布它。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 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.org/ui">
<h:head></h:head>
<h:body>
<h:form id="form1">
    <p:growl id="messages" showDetail="true" />
    <p:dataTable var="message" value="#{messageBean.messages}" id="table">
        <p:column headerText="Nom Complet" style="width:200px">
            <h:outputText value="#{message.nomComplet}" />
        </p:column>
        <p:column headerText="Telephone" style="width:200px">
            <h:outputText value="#{message.telephone}" />
        </p:column>
        <p:column headerText="Email" style="width:200px">
            <h:outputText value="#{message.email}" />
        </p:column>
        <p:column headerText="Objet" style="width:200px">
            <h:outputText value="#{message.objet}" />
        </p:column>
        <p:column headerText="Options" style="width:200px">
            <p:commandLink onclick="PF('dlg3').show();" process="@this"
                actionListener="#{messageBean.init(message)}">
                <h:graphicImage value="/Administration/img/afficher2.jpg"
                    style="width:60px;height:60px;" />
            </p:commandLink>
            <p:commandLink>
                <h:graphicImage value="/Administration/img/reply.png"
                    style="width:60px;height:60px;" />
            </p:commandLink>
            <p:commandLink actionListener="#{messageBean.Supprimer(message)}"
                ajax="true" update=":form1:table" process=":form1:table">
                <p:graphicImage value="/Administration/img/spprimer.png"
                    style="width:60px;height:60px;" />
                <p:confirm header="Confirmation" message="êtes vous sur?"
                    icon="ui-icon-alert" />
            </p:commandLink>
            <p:confirmDialog global="true" showEffect="fade"
                hideEffect="explode">
                <p:commandButton value="Yes" type="button"
                    styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
                    update="table" />
                <p:commandButton value="No" type="button"
                    styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
            </p:confirmDialog>
        </p:column>
    </p:dataTable>
<!-- the problem is the dialog below -->
    <p:dialog header="Message" widgetVar="dlg3" showEffect="explode"
        hideEffect="bounce" resizable="true" >
        <h:form>
            <p:panelGrid columns="2">
                <h:outputLabel value="Nom Complet: " />
                <h:inputTextarea id="firstname" value="#{messageBean.message.nomComplet}" />
                <h:outputLabel value="Telephone :" />
                <h:outputLabel id="Telephone"
                    value="#{messageBean.message.telephone}" />
                <h:outputLabel value="Email :" />
                <p:outputLabel id="Email" value="#{messageBean.message.email}" />
                <h:outputLabel value="Objet :" />
                <h:outputLabel id="Objet" value="#{messageBean.message.objet}" />
                <h:outputLabel value="TextMessage :" />
                <h:outputLabel id="TextMessage"
                    value="#{messageBean.message.textMessage}" />
            </p:panelGrid>
        </h:form>
    </p:dialog>
</h:form>
<ui:remove>
    <!--<p:dialog widgetVar="dlg2" global="true" showEffect="fade"
        hideEffect="explode">
        <h:panelGrid columns="1">
            <h:outputText value="êtes vous sur?" />
            <p:separator />
            <h:panelGrid columns="2">
                <p:commandButton value="Yes" type="button"
                    styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                <p:commandButton value="No" type="button"
                    styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
            </h:panelGrid>
        </h:panelGrid> 
        </p:dialog> -->
</ui:remove>

看起来像是更新问题。bean从xhtml页面获取值吗?如果他得到它,试着替换这两行:

<p:commandLink onclick="PF('dlg3').show();" process="@this" actionListener="#{messageBean.init(message)}">
<p:dialog header="Message" widgetVar="dlg3" showEffect="explode" hideEffect="bounce" resizable="true">
由:

<p:commandLink onclick="PF('dlg3').show();" update=":form1:dlg3" process="@this" actionListener="#{messageBean.init(message)}">
<p:dialog header="Message" id="dlg3" widgetVar="dlg3" showEffect="explode" hideEffect="bounce" resizable="true">

相关内容

  • 没有找到相关文章

最新更新