• 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

Dynamic action forward?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to know if there is a way to pass a variable to the path properties of the <forward /> tag for a specific action within the Struts-Config.xml.

Ex:

mapping.findForward("DynamicForward");

From my Action class and map in struts-config with something like this:
<action path"/tasknotify" scope="request"
type="sync.server.contact.AgentNotify" name="AgentNotifyForm"
input="/agentapp/dummy.jsp" validate="false">
<forward name="DynamicForward" path= "Variable containing dynamic
path"> </forward>
</action>
Has anyone come across a solution for this issue (<forward name="DynamicForward" path= "Variable containing dynamic path" </forward> ?
Thanks in Advance
Raj Chacko
 
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 raj

There is no way u can make ur path variable dynamic as once the config file is loaded it will be freezed mean to say that u cant set the path ..................but the same thing can be achieved( i mean to say the path will be fixed an just u need to pass different variables with diff values) before forwading them set them in request scope and u will be able to access them in ur resource ....................

i hope u got what i am saying u cant get back if u have any issues in this
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another thing you can do is dynamically generate a new ActionForward object that your Action can return. For example, in your action you might have the following:



Naturally you will want to replace "/myAction.do" with your dyamically generated path, but you get the idea.
[ October 19, 2004: Message edited by: Jason Menard ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same issue and couldnt find the answer but what I did was in Action.java you can use response.sendRedirect("http://google.com/"+yourVariable) instead of using a variable in path of struts-config.xml
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic