File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic action forward?

 
Raj Chacko
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
sreenath reddy
Ranch Hand
Posts: 415
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Jason Menard
Sheriff
Posts: 6450
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
mary yaddah
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic