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 Mon, 24 Mar 2003 22:23:14 GMT


On Mon, 24 Mar 2003, Vic Cekvenich wrote:

> Date: Mon, 24 Mar 2003 17:02:44 -0500
> From: Vic Cekvenich <vc@basebeans.com>
> Reply-To: Struts Developers List <struts-dev@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: forms tag ? serialaizable
>
> AFAIK we can't specify the "type of class" that the form bean is in, in
> struts config. (not formbean, but <form-beans >)
>
> For example, <form-beans type= "myserilazableformbeanbase" >
>
> This would allow me to implement session fail over of session beans.
>

If you really want to check that all your form beans subclassed some
common base class, you could build a PlugIn that checked it at webapp
startup time (parse struts-config.xml yourself and test all the form bean
classes as needed), but this seems like overkill to me.

> AFAIK, this was depercated in 1.1.
> Yes, this can be miss-used but....
>
> So can someone educate me that this works, else it's a feature request.
>
> Easy way to test is to add this to resin, for example:
>    <session-config>
>      <file-store>WEB-INF/session</file-store>
>    </session-config>
>
> This give me exception that formbean is not seriazable (concreate class
> is, ie <form-bean name="userBean"
> type="org.apache.scaffoldingLib.beans.UserBean"/> is, but the base class
> is not. This is true of Collections as well)

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.

The servlet spec requires that a container disallow setting a session
attribute that is not Serializable if you use the <distributable> element
in your web.xml file.  Tomcat implements this behavior, and it should be
portable to any other container that conforms to the spec.

> tia,
> Vic

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