mojarra
mojarra copied to clipboard
@ViewScoped @ManagedBean destroyed when using <h:link includeViewParams=“true”>
I'm using Mojarra 2.2.12. I have a case where a @ViewScoped @ManagedBean is immediately destroyed on page load, although the view is not ended. The problem is reproducible with solely the below in <h:body>: <h:outputText value="#
{testBean.value}
" /> <h:link outcome="other" includeViewParams="true">link</h:link> The other must refer to a different view and not the same view. There's no <f:viewParam> necessary to reproduce the problem.
And the below bean:
import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped;
@ManagedBean @ViewScoped public class TestBean implements Serializable {
@PostConstruct public void init()
{ System.out.println("@PostConstruct on " + this); }
@PreDestroy public void clear()
{ System.out.println("@PreDestroy on " + this); }
public String getValue()
{ return "test"; }
} If we remove includeViewParams="true" attribute, then the bean is not immediately destroyed.Why does includeViewParams="true" cause this behavior?
Environment
java8, tomcat7, jsf 2.2 mojarra 2.2.12
Affected Versions
[2.2.12]
Reported by jlerbsc
jlerbsc said: Ok thanks i try this case with mojarra 2.2.14 and i have the same issue. And what do I do now?
Was assigned to ren.zhijun.oracle
This issue was imported from java.net JIRA JAVASERVERFACES-4069
Please see this important message regarding community contributions to Mojarra.
https://javaee.groups.io/g/jsf-spec/message/30
Also, please consider joining that group, as that group has taken the place of the old [email protected] mailing list.
Thanks,
Ed Burns