• 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

setParams from action

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello
I have never had a reason to do this, and I could do it through a formbean, but I want to pass control to another action and set the parameter values. How would I do this from within the originating action? Sorry if this is obvious, but then everything is to someone, grin. tia.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest is to define a forward that points to the second action.

Note that action chaining is *strongly* discouraged. Searching the web for "struts +action chaining" turns up a number of references which may or may not be helpful depending on what you're actually trying to accomplish.
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dave
Thanks. Yes, I know that is a gauche hack, however what design would you recommend? I have an action/form bean process from which I want to call another action/form bean process. Is it as simple as include the params of action2 in formbean 1 and just set them in action1?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd recommend just about anything else.

Ideally, actions are a relatively thin layer between web and business logic. If business logic is wrapped up in reasonable ways it's as easy as using the same business logic in the action in question rather than running the request through another action. I have yet to run across a legitimate reason to chain actions, but that could just be a consequence of the particular apps I've written.

There are a few ways to chain actions in S1; the search query I offered before turns up most (or all?) of them.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic