Change dialog header property before dialog.show()

UI Components for JSF
Post Reply
keruke
Posts: 15
Joined: 10 Apr 2010, 00:39

10 Apr 2010, 00:57

Hi,

I have a session backed bean for change the header and content of a dialog.
After click a command button, myAction event change the header property and the content property of my Test backed bean. But after dialog show, only the content have the new values, the header of the dialog is not refreshed. I dont'k know if this is possible.

This is my enviroment:
Apache Tomcat/6.0.20
Mojarra 2.0.2
PrimeFaces 2.0.0

Thanks in advance.

This is my web page code:

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui" >
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <p:commandButton id="c1" update="display" value="send" actionListener="#{Test.myAction}" oncomplete="dialog.show()" />
            <p:outputPanel id="display">
                <p:dialog widgetVar="dialog" id="idDialog" modal="true" header="#{Test.header}" style="z-index: 10;">
                    <h:outputText value="#{Test.content}" />
                </p:dialog>
            </p:outputPanel>           
        </h:form>
    </h:body>
</html>

This is my Test backed bean:

Code: Select all

public class Test {

    private String content;
    private int count;
    private String header;

    /** Creates a new instance of Test */
    public Test() {
        content = "";
        header = "";
    }

    public void myAction(ActionEvent e) {
        if ((count % 2) == 1) {
            content = "Content ONE";
            header = "Header ONE";
        }
        else
        {
            content = "Content TWO";
            header = "Header TWO";
        }
        count++;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }
}
Primefaces 3.2. Tomcat 6. Mojarra 2.1.7

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

10 Apr 2010, 23:48

Hi keruke, your code works here (the dialog header change in each call). Im using SNAPSHOT 2.0.1, could you try it?
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

keruke
Posts: 15
Joined: 10 Apr 2010, 00:39

11 Apr 2010, 01:07

Hi Rafael,

Thank you for your response, yes, I have used the 2.0.1 snapshot and works perfect in firefox and IE. I don't know what is the problem with primeFaces 2.0.0. SNAPSHOT is a stable version ??, I don't know, I am looking for a solution to make it work in 2.0.0.

Thanks.
Primefaces 3.2. Tomcat 6. Mojarra 2.1.7

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

11 Apr 2010, 02:36

You're welcome,

No, SNAPSHOT isn't a stable version but in the other hand it solves many reported issues in old version, i'd suggest you to use it in the development enviroment and use a stable version in prodution.
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 28 guests