Re: IF statement in struts-config.xml

2001-08-06 Thread Bill Clinton

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  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




RE: IF statement in struts-config.xml

2001-08-06 Thread Assenza, Chris

Hmmm, I'm not sure I see the value in this (at least actually IN the XML
file) - could you explain in more detail what you intend to do? 

Chris

-Original Message-
From: Yi-Xiong Zhou [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 5:02 PM
To: '[EMAIL PROTECTED]'
Subject: IF statement in struts-config.xml


Hi, 

I think it will be very useful if struts can have IF statement in
struts-config.xml to control the  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