This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Originally posted by Merrill Higginson: Sorry, but the signature of the execute method is fixed in Struts 1 and cannot be changed, so you won't be able to pass any objects to it other than the standard ones.
If you'll tell us more about the specific problem you're trying to solve, maybe we can suggest some other alternatives.
Joined: Apr 02, 2008
HI I Have value object to be passed throu various layer in my application.I like to convert form bean to value object and pass it to action's execute method instead of Form object. please help in this
Hint My Value object's property's name is different from form bean parameter naming. I hope ,i can't use apache beanUtil for this.
Joined: Feb 15, 2005
As I mentioned before, your idea of passing other objects to the execute method simply isn't going to work. Aside from restrictions in Struts, you also have the restriction that you're passing data to and from the HTTP layer.
The obvious solution is just to store these value objects in the HTTPSession. If you do this, you have access to the object from any Action class anywhere along the line.
In my view, the HTTPSession has gotten an undeserved bad reputation. Developers have read white papers warning against the dangers of over-using the HTTPSession, and have taken that to mean that one should never use the HTTPSession. In today's application servers, a reasonable amount of data can be stored in an HTTPSession without incurring any significant performance hit.
If you're adamantly opposed to using the HTTPSession for these objects, the next best thing would be to declare these objects as properties of your ActionForm bean. That way they get passed along with the ActionForm. [ June 19, 2008: Message edited by: Merrill Higginson ]