• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing object to Execute method

 
Ranch Hand
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IN struts 1.2 ,I like to pass an object to Execute method of action class ,How it can be done?,I do not want form object in execute method.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jacob deiter
Ranch Hand
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
jacob deiter
Ranch Hand
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic