aspose file tools*
The moose likes Struts and the fly likes Will Struts 1.3 replace a form bean in scope? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Will Struts 1.3 replace a form bean in scope?" Watch "Will Struts 1.3 replace a form bean in scope?" New topic
Author

Will Struts 1.3 replace a form bean in scope?

Steve Dambrosio
Greenhorn

Joined: Apr 02, 2009
Posts: 28
Howdy,
I'm seeing a behavior in Struts 1.3.10 and didn't happen in Struts 1.1. If I already have a form bean in scope (in my case session scope) and it is of a different type than what is defined in the <form-bean> definition in struts-config.xml, Struts will replace it! The user manual says:
Check for an instance of a bean of the appropriate class, under the appropriate key, in the appropriate scope (request or session).
If there is no such bean instance available, a new one is automatically created and added to the appropriate scope (request or session).

I suppose if I take the "of the appropriate class" phrase literally, then it seems to be the correct behavior, but then they go on to say "created and added" which is ambiguous. I'd feel better if I can find something that says explicitly that a form bean in session scope can be replaced. Can anyone confirm or deny this behavior? Thanks!
 
 
subject: Will Struts 1.3 replace a form bean in scope?