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;
}
}