0

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.

user3410249
  • 161
  • 4
  • 14
  • @Kukeltje: there's a `` in navigation case. – BalusC Apr 17 '20 at 08:43
  • @BalusC, oops... strange, I did a 'search' on redirect in the stackoverflow page, no idea why my browser missed this. Sorry... Namespace 'thing' remains btw.. .https://stackoverflow.com/questions/31068678/which-xml-namespace-to-use-with-jsf-2-2-and-up I think I had a problem once when using the older namespaces or a mix caused problems... Might that be the case here? – Kukeltje Apr 17 '20 at 08:48
  • @Kukeltje: Problem is too ambiguous here. OP needs to debug and tell in developer's perspective instead of enduser's perspective what exactly happens (not) and filter noise from the question. Only one thing strikes me: OP basically implies he's using "JSF 2.2.16" in both environments. But Liberty already ships with its own JSF impl/version and it's certainly not the same in 19/20. I'd guess a simple classpath pollution. – BalusC Apr 17 '20 at 08:52
  • @BalusC, It's working fine in WebSphere Liberty version 20.0.0.1. Only I saw difference in 20.0.0.2. – user3410249 Apr 17 '20 at 09:36
  • @user3410249 what Liberty features are you using? – wtlucy Apr 17 '20 at 12:12
  • @wtlucy : These are the features am using, localConnector-1.0, appSecurity-2.0, ldapRegistry-3.0, jsfContainer-2.2, cdi-1.2, servlet-3.1, el-3.0, ejbLite-3.2, jdbc-4.1, jaxrs-2.0, jsonp-1.0, jndi-1.0, monitor-1.0, jpaContainer-2.1. – user3410249 Apr 17 '20 at 12:19
  • Try reducing to pure JSF. Replace the `p;:messages` with an `h;messages`, the `p:commandButton` with an `h:commandButton` with `f:ajax` – Kukeltje Apr 17 '20 at 12:40
  • @Kukeltje: Tried it. No luck. – user3410249 Apr 17 '20 at 14:37
  • I did not expect this would 'solve' it, it just proves the issue is not PF related and the question and tags should be changed. This should have been tried before. It is called 'root-cause analysis' and is part of debugging... – Kukeltje Apr 17 '20 at 19:28
  • when I have this two jar files in class path am facing this issue, ```myfaces-extcdi-jsf20-module-impl-1.0.6.jar``` and ```myfaces-extcdi-jsf20-module-api-1.0.6.jar```. If I remove these jar file Message get cleared. But I need these two jar files. It might be conflict with Liberty 20.0.0.2 version. Another one point without remove above mentioned jar files: If I replace Liberty 20.0.0.2 library ```com.ibm.ws.cdi.weld_1.0.37.jar``` with Liberty 20.0.0.1 library ```com.ibm.ws.cdi.weld_1.0.36.jar```. Message get cleared. – user3410249 Apr 28 '20 at 07:26

0 Answers0