• 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

dynamically changing where an action forwards to.

 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have devleoped a web app using action forms, company loves the app.
However the buisess rules have changed.

If the action succeeds, the company now wants to forward to some URL that they want to specify as a paramter in the request, or a database table lookup.

any suggestions
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I just wonder whether the URLs you want to forward after action succeeds are limited or going to change dynamically.
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes they want to randomly change where the success of an action goes. They want to be able to speciy either a relaitive URL or to some URL on another webserver/web app server.

I don't know why, but that is what they want.
 
Author
Posts: 93
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

It is pretty easy to re-direct an Action dynamically. Remember, your ActionMapping class passed into the execute() holds instances of an ActionForward object. Each ActionForward represents a different forward you can redirect to. You normally use the ActionMapping.findForward() method to return an ActionForward.

You can create an ActionForward directly and return it from the execute method. You can look at the source for the ActionForward. There are a number of different public constructor you can use to set what you are looking for.

I hope that answers your question.

Thanks,
John
 
Shankar Narayana
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think John has got the right answer for you.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It is pretty easy to re-direct an Action dynamically. Remember, your ActionMapping class passed into the execute() holds instances of an ActionForward object. Each ActionForward represents a different forward you can redirect to. You normally use the ActionMapping.findForward() method to return an ActionForward.



So, to solve this problem
1. Change code in ActionForm or not
2. Change config in struts-config.xml or not
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic