You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Denis Kniazhev (JIRA)" <de...@myfaces.apache.org> on 2012/06/04 10:40:24 UTC

[jira] [Created] (MYFACES-3558) ViewScoped bean re-created on every ajax request

Denis Kniazhev created MYFACES-3558:
---------------------------------------

             Summary: ViewScoped bean re-created on every ajax request
                 Key: MYFACES-3558
                 URL: https://issues.apache.org/jira/browse/MYFACES-3558
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.1.7
         Environment: Ubuntu 12.04
            Reporter: Denis Kniazhev


Given a view scoped bean:

@ViewScoped
public class Bean implements Serializable {
    @PostConstruct
    public void pc() {
        System.out.println("in postConstruct");
    }
}

and a simple form:

    <h:form>
        <h:commandLink value="update">
            <f:ajax render="label"/>
        </h:commandLink>
        <h:outputText id="label" value="#{bean}"/>
    </h:form>

Repeatable hitting on "update" button makes the value of label change:
com.denisk.test.Bean@5b62a166
com.denisk.test.Bean@27afca98
com.denisk.test.Bean@3a93ea5f

PostConstruct is fired only once though.
I know that there is plenty of ViewScoped-related havoc in JSF2, which is described in 
http://java.net/jira/browse/JAVASERVERFACES-1492
and related JSF spec issue (which will be fixed in spec v. 2.2):
http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-787
But current defect seems to be MyFaces-specific since on Mojarra 2.1.8 this works just fine

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira