Hello,
      The mappings that are set up in the struts-config.xml can be 
modified programmatically.  So, if you want to reconfigure a forward, 
you would not need an if statement in the struts config, but I believe 
you can do it in your program that references the forward.

For example:

ActionForward forward = mapping.findForward("success");
forward.setPath("my new path");

disclaimer:
I have not changed actual forwards this way (except by accident).  I 
have modified the paths in a forward, but I have always created a new 
forward object to be returned by my ActionServlet.  I would be worried 
that a modified forward could be garbage collected and set back to its 
original value from the struts-config when called for again.  Maybe 
someone else could comment on whether or not this is a potential problem.

I do it like this to avoid potential problems:

ActionForward forward = mapping.findForward("success"); 
ActionForward newForward = new ActionForward(forward.getPath());
//do stuff to modify path
return newForward;

Bill


forward.setPath("my new path");







Yi-Xiong Zhou wrote:

> Hi, 
> 
> I think it will be very useful if struts can have IF statement in
> struts-config.xml to control the <foward/> action. 
> 
> I am thinking of building a purely configurable system using struts
> framework. A system whose actions can be reassembled and chained to make new
> functionalities. IF statements are key to chain actions. 
> 
> Has any plan to implement the IF function in struts-config.xml underway? 
> 
> Yi-Xiong Zhou

Reply via email to