mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

@ViewScoped @ManagedBean destroyed when using <h:link includeViewParams=“true”>

Open javaserverfaces opened this issue 10 years ago • 5 comments

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]

javaserverfaces avatar Sep 25 '15 12:09 javaserverfaces

Reported by jlerbsc

javaserverfaces avatar Sep 25 '15 12:09 javaserverfaces

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?

javaserverfaces avatar Dec 17 '16 21:12 javaserverfaces

Was assigned to ren.zhijun.oracle

javaserverfaces avatar Sep 25 '15 12:09 javaserverfaces

This issue was imported from java.net JIRA JAVASERVERFACES-4069

javaserverfaces avatar May 02 '17 10:05 javaserverfaces

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

edburns avatar Oct 29 '17 03:10 edburns