Struts doesn't maintain a pool of beans (or any other object). 

It just looks for an existing bean in the target scope before creating a
new one of the same class. The ActionForm beans all have the same name
(given in Struts-config), and so if it didn't, the new one would just
overwrite the old one anyway. This saves an object create. In the case
of a session bean, it also allows you to retain the properties, if
reset() doesn't get in the way.

The default reset() does nothing. I imagine that the class in question
is blindly setting the properties to null, as all the examples suggest.
In this case, it should be more careful

For the Struts source, see processActionForm(), processPopulate(), and
process() in ActionServlet.java. 

"Palmer, Nick" wrote:
> 
> I understand the purpose of reset, but do not understand how and why struts
> chooses to reuse a particular bean by resetting it. Does it take then bean
> from the users session, or does it pull it from a pool of beans of that
> type. If it takes it from the session and then calls reset I would be
> comfortable overriding reset and making it do nothing, however if it does
> the latter than there is a problem in that it may pull some other users bean
> from the pool.
> 
> This could lead to really undesirable behavior, like one user resetting the
> password for some other user etc...
> 
> Does anybody know which way struts works in this respect? I will try to look
> at the source and figure this part out. I think the small change I suggested
> would make mulitpage forms a breeze in struts.
> 
> -Nick

Reply via email to