You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Kahlau <mk...@web.de> on 2005/11/29 13:07:54 UTC

WIKI article - How JSF State Management Works

Hi!


I have a question regarding a MyFaces WIKI article about state management.
In the article is described, that BackingBeans will have to implement the
Serializable interface or StateHolder. I neither implement Serializable, nor
StateHolder, but my BackingBeans work. Isn't the article up-to-date, or is
there some misunderstanding?

http://wiki.apache.org/myfaces/How_JSF_State_Management_Works



Regards,
Matthias


Re: WIKI article - How JSF State Management Works

Posted by Mike Kienenberger <mk...@gmail.com>.
Actually, the solution is right at the top of that message:
"serializing ListDataModel.getWrappedData()" instead.

You don't serialize DataModel, just the data in it.   You can get a
reference to it explicitly with the above, or you can serialize your
model some other way, like putting the data into its own backing bean
and using t:saveState on it (that's my standard approach).   But then,
I don't have to worry about container serialization since I use
client-side state saving and go out of my way to avoid creating
session-scoped data.

On 11/30/05, Matthias Kahlau <mk...@web.de> wrote:
> Hi!
>
>
> Many thanks for your response. I just implemented the Serializable interface
> in my BackingBeans, but I get errors from JBoss now, saying that
> javax.faces.model.ListDataModel is not serializable. I need to use
> ListDataModel to wrap the java.util.List instances of data shown in
> dataTables.
>
> How did you solve that problem, if it had been a task for you?
>
> The problem has also been mentioned in the following post, but it shows no
> concrete solutions for me.
>
> http://www.mail-archive.com/users@myfaces.apache.org/msg12092.html
>
>
>
> Regards,
> Matthias
>
> > -----Ursprüngliche Nachricht-----
> > Von: users-return-13004-mkahlau=web.de@myfaces.apache.org
> > [mailto:users-return-13004-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> > von Mike Kienenberger
> > Gesendet: Dienstag, 29. November 2005 17:49
> > An: MyFaces Discussion
> > Betreff: Re: WIKI article - How JSF State Management Works
> >
> >
> > I think JSF doesn't perform saveState on backing beans in this
> > situation.   I'm not an expert on container session serialization, but
> > your container might attempt to serialize session-scoped backing beans
> > when the container shuts down or for clustering reasons.
> >
> > Again, I'm guessing somewhat on this as I've never really researched
> > it.   If you want to be safe, always implement serializable.   If it's
> > not used, it only costs you a little code (just an "implements"
> > statement in most cases).  And if it's used (whether by the container
> > or JSF), then you don't have to worry about it.
> >
> > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > Hi!
> > >
> > >
> > > Yes, I use server-side state saving and session-scoped BackingBeans. My
> > > BackingBeans don't have any superclasses, and don't implement
> > Serializable
> > > or StateHolder directly. Referencing to your explanation, the Container
> > > seems to manage the state saving. Is this really container
> > dependent, that
> > > said, is it possible, that the app won't run in a different
> > container. Do I
> > > have to implement Serializable in the BackingBeans, that the app is
> > > container-independent, and will that be enough? (that isn't
> > mentioned in the
> > > JSF book from Andy Bosch that I read, is that MyFaces specific?)
> > >
> > >
> > > Regards,
> > > Matthias
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: users-return-13000-mkahlau=web.de@myfaces.apache.org
> > > >
> > [mailto:users-return-13000-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> > > > von Mike Kienenberger
> > > > Gesendet: Dienstag, 29. November 2005 17:24
> > > > An: MyFaces Discussion
> > > > Betreff: Re: WIKI article - How JSF State Management Works
> > > >
> > > >
> > > > It's hard to comment without a specific use case.
> > > >
> > > > You only have to implement Serializable or StateHolder if you're going
> > > > to save the bean.  Maybe you're not saving the bean.   If you're using
> > > > server-side state management and session-scoped beans, it'd depend on
> > > > your container whether they're "saved."
> > > >
> > > > If you're using client-side state management, they should always
> > > > be "saved."
> > > >
> > > > Also, check your inheritance hierarchy.  Perhaps some base superclass
> > > > is already implementing Serializable.
> > > >
> > > > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > > > Hi!
> > > > >
> > > > >
> > > > > I have a question regarding a MyFaces WIKI article about state
> > > > management.
> > > > > In the article is described, that BackingBeans will have to
> > > > implement the
> > > > > Serializable interface or StateHolder. I neither implement
> > > > Serializable, nor
> > > > > StateHolder, but my BackingBeans work. Isn't the article
> > > > up-to-date, or is
> > > > > there some misunderstanding?
> > > > >
> > > > > http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
> > > > >
> > > > >
> > > > >
> > > > > Regards,
> > > > > Matthias
> > > > >
> > > > >
> > >
> > >
>
>

Re: AW: WIKI article - How JSF State Management Works

Posted by Simon Kitching <sk...@obsidium.com>.
Matthias Kahlau wrote:
> Hi!
> 
> 
> Many thanks for your response. I just implemented the Serializable interface
> in my BackingBeans, but I get errors from JBoss now, saying that
> javax.faces.model.ListDataModel is not serializable. I need to use
> ListDataModel to wrap the java.util.List instances of data shown in
> dataTables.
> 
> How did you solve that problem, if it had been a task for you?
> 
> The problem has also been mentioned in the following post, but it shows no
> concrete solutions for me.
> 
> http://www.mail-archive.com/users@myfaces.apache.org/msg12092.html

I've added an entry to the wiki FAQ for this:
   http://wiki.apache.org/myfaces/FAQ

Regards,

Simon

Re: AW: WIKI article - How JSF State Management Works

Posted by gr...@intellicare.com.
Hi Mathias, I think your problem is similar to mine. Mathias Brökelmann 
solved it:

http://www.mail-archive.com/users@myfaces.apache.org/msg11289.html

Regards,
Geeta

mkahlau@web.de wrote on 11/30/2005 12:50:18 PM:

> Hi!
> 
> 
> Many thanks for your response. I just implemented the Serializable 
interface
> in my BackingBeans, but I get errors from JBoss now, saying that
> javax.faces.model.ListDataModel is not serializable. I need to use
> ListDataModel to wrap the java.util.List instances of data shown in
> dataTables.
> 
> How did you solve that problem, if it had been a task for you?
> 
> The problem has also been mentioned in the following post, but it shows 
no
> concrete solutions for me.
> 
> http://www.mail-archive.com/users@myfaces.apache.org/msg12092.html
> 
> 
> 
> Regards,
> Matthias
> 
> > -----Ursprüngliche Nachricht-----
> > Von: users-return-13004-mkahlau=web.de@myfaces.apache.org
> > [mailto:users-return-13004-mkahlau=web.de@myfaces.apache.org]Im 
Auftrag
> > von Mike Kienenberger
> > Gesendet: Dienstag, 29. November 2005 17:49
> > An: MyFaces Discussion
> > Betreff: Re: WIKI article - How JSF State Management Works
> >
> >
> > I think JSF doesn't perform saveState on backing beans in this
> > situation.   I'm not an expert on container session serialization, but
> > your container might attempt to serialize session-scoped backing beans
> > when the container shuts down or for clustering reasons.
> >
> > Again, I'm guessing somewhat on this as I've never really researched
> > it.   If you want to be safe, always implement serializable.   If it's
> > not used, it only costs you a little code (just an "implements"
> > statement in most cases).  And if it's used (whether by the container
> > or JSF), then you don't have to worry about it.
> >
> > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > Hi!
> > >
> > >
> > > Yes, I use server-side state saving and session-scoped BackingBeans. 
My
> > > BackingBeans don't have any superclasses, and don't implement
> > Serializable
> > > or StateHolder directly. Referencing to your explanation, the 
Container
> > > seems to manage the state saving. Is this really container
> > dependent, that
> > > said, is it possible, that the app won't run in a different
> > container. Do I
> > > have to implement Serializable in the BackingBeans, that the app is
> > > container-independent, and will that be enough? (that isn't
> > mentioned in the
> > > JSF book from Andy Bosch that I read, is that MyFaces specific?)
> > >
> > >
> > > Regards,
> > > Matthias
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: users-return-13000-mkahlau=web.de@myfaces.apache.org
> > > >
> > [mailto:users-return-13000-mkahlau=web.de@myfaces.apache.org]Im 
Auftrag
> > > > von Mike Kienenberger
> > > > Gesendet: Dienstag, 29. November 2005 17:24
> > > > An: MyFaces Discussion
> > > > Betreff: Re: WIKI article - How JSF State Management Works
> > > >
> > > >
> > > > It's hard to comment without a specific use case.
> > > >
> > > > You only have to implement Serializable or StateHolder if you're 
going
> > > > to save the bean.  Maybe you're not saving the bean.   If you're 
using
> > > > server-side state management and session-scoped beans, it'd depend 
on
> > > > your container whether they're "saved."
> > > >
> > > > If you're using client-side state management, they should always
> > > > be "saved."
> > > >
> > > > Also, check your inheritance hierarchy.  Perhaps some base 
superclass
> > > > is already implementing Serializable.
> > > >
> > > > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > > > Hi!
> > > > >
> > > > >
> > > > > I have a question regarding a MyFaces WIKI article about state
> > > > management.
> > > > > In the article is described, that BackingBeans will have to
> > > > implement the
> > > > > Serializable interface or StateHolder. I neither implement
> > > > Serializable, nor
> > > > > StateHolder, but my BackingBeans work. Isn't the article
> > > > up-to-date, or is
> > > > > there some misunderstanding?
> > > > >
> > > > > http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
> > > > >
> > > > >
> > > > >
> > > > > Regards,
> > > > > Matthias
> > > > >
> > > > >
> > >
> > >
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

> 
> CONFIDENTIALITY NOTICE:This email is intended solely for the person 
> or entity to which it is addressed and may contain confidential 
> and/or protected health information.  Any duplication, 
> dissemination, action taken in reliance upon, or other use of this 
> information by persons or entities other than the intended recipient
> is prohibited and may violate applicable laws.  If this email has 
> been received in error, please notify the sender and delete the 
> information from your system.  The views expressed in this email are
> those of the sender and may not necessarily represent the views of 
> IntelliCare.

AW: WIKI article - How JSF State Management Works

Posted by Matthias Kahlau <mk...@web.de>.
Hi!


Many thanks for your response. I just implemented the Serializable interface
in my BackingBeans, but I get errors from JBoss now, saying that
javax.faces.model.ListDataModel is not serializable. I need to use
ListDataModel to wrap the java.util.List instances of data shown in
dataTables.

How did you solve that problem, if it had been a task for you?

The problem has also been mentioned in the following post, but it shows no
concrete solutions for me.

http://www.mail-archive.com/users@myfaces.apache.org/msg12092.html



Regards,
Matthias

> -----Ursprüngliche Nachricht-----
> Von: users-return-13004-mkahlau=web.de@myfaces.apache.org
> [mailto:users-return-13004-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> von Mike Kienenberger
> Gesendet: Dienstag, 29. November 2005 17:49
> An: MyFaces Discussion
> Betreff: Re: WIKI article - How JSF State Management Works
>
>
> I think JSF doesn't perform saveState on backing beans in this
> situation.   I'm not an expert on container session serialization, but
> your container might attempt to serialize session-scoped backing beans
> when the container shuts down or for clustering reasons.
>
> Again, I'm guessing somewhat on this as I've never really researched
> it.   If you want to be safe, always implement serializable.   If it's
> not used, it only costs you a little code (just an "implements"
> statement in most cases).  And if it's used (whether by the container
> or JSF), then you don't have to worry about it.
>
> On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > Hi!
> >
> >
> > Yes, I use server-side state saving and session-scoped BackingBeans. My
> > BackingBeans don't have any superclasses, and don't implement
> Serializable
> > or StateHolder directly. Referencing to your explanation, the Container
> > seems to manage the state saving. Is this really container
> dependent, that
> > said, is it possible, that the app won't run in a different
> container. Do I
> > have to implement Serializable in the BackingBeans, that the app is
> > container-independent, and will that be enough? (that isn't
> mentioned in the
> > JSF book from Andy Bosch that I read, is that MyFaces specific?)
> >
> >
> > Regards,
> > Matthias
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: users-return-13000-mkahlau=web.de@myfaces.apache.org
> > >
> [mailto:users-return-13000-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> > > von Mike Kienenberger
> > > Gesendet: Dienstag, 29. November 2005 17:24
> > > An: MyFaces Discussion
> > > Betreff: Re: WIKI article - How JSF State Management Works
> > >
> > >
> > > It's hard to comment without a specific use case.
> > >
> > > You only have to implement Serializable or StateHolder if you're going
> > > to save the bean.  Maybe you're not saving the bean.   If you're using
> > > server-side state management and session-scoped beans, it'd depend on
> > > your container whether they're "saved."
> > >
> > > If you're using client-side state management, they should always
> > > be "saved."
> > >
> > > Also, check your inheritance hierarchy.  Perhaps some base superclass
> > > is already implementing Serializable.
> > >
> > > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > > Hi!
> > > >
> > > >
> > > > I have a question regarding a MyFaces WIKI article about state
> > > management.
> > > > In the article is described, that BackingBeans will have to
> > > implement the
> > > > Serializable interface or StateHolder. I neither implement
> > > Serializable, nor
> > > > StateHolder, but my BackingBeans work. Isn't the article
> > > up-to-date, or is
> > > > there some misunderstanding?
> > > >
> > > > http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
> > > >
> > > >
> > > >
> > > > Regards,
> > > > Matthias
> > > >
> > > >
> >
> >


Re: WIKI article - How JSF State Management Works

Posted by Mike Kienenberger <mk...@gmail.com>.
I think JSF doesn't perform saveState on backing beans in this
situation.   I'm not an expert on container session serialization, but
your container might attempt to serialize session-scoped backing beans
when the container shuts down or for clustering reasons.

Again, I'm guessing somewhat on this as I've never really researched
it.   If you want to be safe, always implement serializable.   If it's
not used, it only costs you a little code (just an "implements"
statement in most cases).  And if it's used (whether by the container
or JSF), then you don't have to worry about it.

On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> Hi!
>
>
> Yes, I use server-side state saving and session-scoped BackingBeans. My
> BackingBeans don't have any superclasses, and don't implement Serializable
> or StateHolder directly. Referencing to your explanation, the Container
> seems to manage the state saving. Is this really container dependent, that
> said, is it possible, that the app won't run in a different container. Do I
> have to implement Serializable in the BackingBeans, that the app is
> container-independent, and will that be enough? (that isn't mentioned in the
> JSF book from Andy Bosch that I read, is that MyFaces specific?)
>
>
> Regards,
> Matthias
>
> > -----Ursprüngliche Nachricht-----
> > Von: users-return-13000-mkahlau=web.de@myfaces.apache.org
> > [mailto:users-return-13000-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> > von Mike Kienenberger
> > Gesendet: Dienstag, 29. November 2005 17:24
> > An: MyFaces Discussion
> > Betreff: Re: WIKI article - How JSF State Management Works
> >
> >
> > It's hard to comment without a specific use case.
> >
> > You only have to implement Serializable or StateHolder if you're going
> > to save the bean.  Maybe you're not saving the bean.   If you're using
> > server-side state management and session-scoped beans, it'd depend on
> > your container whether they're "saved."
> >
> > If you're using client-side state management, they should always
> > be "saved."
> >
> > Also, check your inheritance hierarchy.  Perhaps some base superclass
> > is already implementing Serializable.
> >
> > On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > > Hi!
> > >
> > >
> > > I have a question regarding a MyFaces WIKI article about state
> > management.
> > > In the article is described, that BackingBeans will have to
> > implement the
> > > Serializable interface or StateHolder. I neither implement
> > Serializable, nor
> > > StateHolder, but my BackingBeans work. Isn't the article
> > up-to-date, or is
> > > there some misunderstanding?
> > >
> > > http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
> > >
> > >
> > >
> > > Regards,
> > > Matthias
> > >
> > >
>
>

AW: WIKI article - How JSF State Management Works

Posted by Matthias Kahlau <mk...@web.de>.
Hi!


Yes, I use server-side state saving and session-scoped BackingBeans. My
BackingBeans don't have any superclasses, and don't implement Serializable
or StateHolder directly. Referencing to your explanation, the Container
seems to manage the state saving. Is this really container dependent, that
said, is it possible, that the app won't run in a different container. Do I
have to implement Serializable in the BackingBeans, that the app is
container-independent, and will that be enough? (that isn't mentioned in the
JSF book from Andy Bosch that I read, is that MyFaces specific?)


Regards,
Matthias

> -----Ursprüngliche Nachricht-----
> Von: users-return-13000-mkahlau=web.de@myfaces.apache.org
> [mailto:users-return-13000-mkahlau=web.de@myfaces.apache.org]Im Auftrag
> von Mike Kienenberger
> Gesendet: Dienstag, 29. November 2005 17:24
> An: MyFaces Discussion
> Betreff: Re: WIKI article - How JSF State Management Works
>
>
> It's hard to comment without a specific use case.
>
> You only have to implement Serializable or StateHolder if you're going
> to save the bean.  Maybe you're not saving the bean.   If you're using
> server-side state management and session-scoped beans, it'd depend on
> your container whether they're "saved."
>
> If you're using client-side state management, they should always
> be "saved."
>
> Also, check your inheritance hierarchy.  Perhaps some base superclass
> is already implementing Serializable.
>
> On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> > Hi!
> >
> >
> > I have a question regarding a MyFaces WIKI article about state
> management.
> > In the article is described, that BackingBeans will have to
> implement the
> > Serializable interface or StateHolder. I neither implement
> Serializable, nor
> > StateHolder, but my BackingBeans work. Isn't the article
> up-to-date, or is
> > there some misunderstanding?
> >
> > http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
> >
> >
> >
> > Regards,
> > Matthias
> >
> >


Re: WIKI article - How JSF State Management Works

Posted by Mike Kienenberger <mk...@gmail.com>.
It's hard to comment without a specific use case.

You only have to implement Serializable or StateHolder if you're going
to save the bean.  Maybe you're not saving the bean.   If you're using
server-side state management and session-scoped beans, it'd depend on
your container whether they're "saved."

If you're using client-side state management, they should always be "saved."

Also, check your inheritance hierarchy.  Perhaps some base superclass
is already implementing Serializable.

On 11/29/05, Matthias Kahlau <mk...@web.de> wrote:
> Hi!
>
>
> I have a question regarding a MyFaces WIKI article about state management.
> In the article is described, that BackingBeans will have to implement the
> Serializable interface or StateHolder. I neither implement Serializable, nor
> StateHolder, but my BackingBeans work. Isn't the article up-to-date, or is
> there some misunderstanding?
>
> http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
>
>
>
> Regards,
> Matthias
>
>