Am developing application using JSF 2.2.16, PrimeFaces 6.2 and WebSphere Liberty server, Now am upgrading Liberty server from 19.0.0.11 to 20.0.0.2. Here am facing issue that FacesMessage not clearing on request. Below is my sample code,
Here is my jsf page 'welcome.xhtml' looks like,
<!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:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h1>Hello World PrimeFaces</h1>
<h:form>
<p:message id="mainMessages" globalOnly="true" autoUpdate="true"/>
<p:commandButton action="#{mainBean.redirect}" value="submit" />
</h:form>
</h:body>
</html>
Here is my 'redirect.xhtml' looks like,
<!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:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h1>Redirect</h1>
<h:form>
<p:message id="mainMessages" globalOnly="true" autoUpdate="true"/>
</h:form>
</h:body>
</html>
below is my sample java code,
@Named(value="mainBean")
@ViewAccessScoped
public class MainBean {
public String redirect(){
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "save");
FacesContext.getCurrentInstance().addMessage(null, message);
return "redirect"
}
}
below is sample navigation-config.xml,
<navigation-case>
<from-action>#{mainBean.redirect}</form-action>
<form-outcome>redirect</form-outcome>
<to-view-id>/pages/redirect.xhtml</to-view-id>
<redirect/>
</navigation-case>
When I click on submit button, it successfully redirected to redirect.xhtml page. But, message was not appeared in screen when am using WebSphere Liberty server 19.0.0.11. But when I Upgrade server to 20.0.0.2. Message getting appear in the screen. I would like to know reason why message appeared in the screen after redirect.