struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: forms tag ? serialaizable
Date Tue, 25 Mar 2003 05:19:02 GMT


On Mon, 24 Mar 2003, Vic Cekvenich wrote:

> Date: Mon, 24 Mar 2003 18:55:00 -0500
> From: Vic Cekvenich <vc@basebeans.com>
> Reply-To: Struts Developers List <struts-dev@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Re: forms tag ? serialaizable
>
> <SNIP>
> >
> > If your UserBean class declares "implements Serializable", this means that
> > UserBean also takes responsibility for saving and restoring the instance
> > variables of the base class as well.  If it doesn't, then your UserBean
> > class is broken.  The only thing the container should need to do is an
> > "instanceof Serializable" test.
> >
>
>
> public class UserBean extends ValidatorForm
> 				implements Serializable, Collection { // class }
>
> My concreate does. But the container I think sees is as
> ValidatorForm.... which it tags as not Serializable and throws an
> exception. I could test by making ActionForm implement Seriazable, see
> if that "fixes" it.
>

What the container should do (and Tomcat in particular does) is an
"instanceof Serializable" check, which will return true if the base class
says "implements Serializable" (which is already true for ActionForm, and
therefore DynaActionForm) or whether the concrete class itself does (as in
your example above).

If you still have a serialization problem with a UserBean declared as you
indicate above, it's likely that one of the instance variables inside
UserBean (or its superclass) cannot actually be serialized.  For example,
if you've got an instance variable of type java.sql.Connection, you'd
definitely run into problems.

>
> tia,
>
> .V

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message