• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Pass control to another Action

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! I have an easy question about struts.
How do I pass the control of the program from an Action to another Action?
Thanks a lot
Miguel
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

U need to not worry about this .its just as good as u forward it to some othjer jsp instead in ur config.xml say forward name='' path="action.do" and this will transfer the control to some other action with the request objects persisted across the multiple actions
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do I have to put redirect to true or context relative to true???
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

see if u r using mapping.findForward(string) then u need not do anything with redirect just map this string to action in struts-confiog.xml and automatically redirect will be false in such situations

but if u trying to use new ActionForward(,) then u need to set the redirect flag to false
 
Sheriff
Posts: 17696
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you describe the interactions and flow that you have in your program now that makes you think that you need to do this (some relevant code snippets might help)? It has been my experience that in most cases, passing control from one Action to another Action is unnecessary and the need to do so can be eliminated by a little refactoring of the code.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

There are many situations where u need to move across two actions .The best examle is u have a list of things on ur UI and u have a delete button which deletes that entry and after this u want to show the user with the new list then first u need to call action for deleting that entry and in the same action u need to call the action for listing of the new records

and many places like this even if u r using pagination with a good framework while u say next page and all its good that u first go to some action where u set the parameters for the pagination in a javabean and later forward that to a business logic written in an action to get the new list for the particular page

hope what i am saying is right ??

Any better ideas on this would be appreciated
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it. thanks a lot!!!
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Miguel Flecha:
I got it. thanks a lot!!!



Miguel,

You have come across a non-trivial problem situation with Struts. See whether the discussions on this page helps:

http://frustratedprogrammer.blogspot.com/2004/07/still-no-dynamic-forwards-in-struts.html

Good luck,
Nalla
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic