You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Krashan Brahmanjara (JIRA)" <de...@myfaces.apache.org> on 2014/05/31 08:33:02 UTC

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

    [ https://issues.apache.org/jira/browse/MYFACES-3558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14014543#comment-14014543 ] 

Krashan Brahmanjara commented on MYFACES-3558:
----------------------------------------------

I use Myfaces 2.2.3 with SERIALIZE_STATE_IN_SESSION=false and i can confirm the problem.
The question is "Some of ViewScoped beans associated with view are re-created on every ajax request or actionListener action"
In above example we stay on the same view so we don't excpect new initialization.


> 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
>            Assignee: Leonardo Uribe
>
> Given a view scoped bean:
> @ManagedBean
> @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 was sent by Atlassian JIRA
(v6.2#6252)