You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Russell Healy <Ru...@msd.govt.nz> on 2003/11/06 04:24:29 UTC

Global forward from anywhere in site when condition met

Is there an elegant way to invoke a global-forward from anywhere in the site when any 
given condition is met?

In my case, I want to invoke a global-forward when a certain attribute is missing from the 
HTTPSession. I want this rule to be applicable across the whole site, but I don't want to 
have to include it in every Action subclass.

One possibility is to subclass Action for my site, (say CheckConditionsAction), do the 
checks in the execute method and forward if the conditions are not met. If the conditions 
are met, then call an abstract method which is implemented in subclasses of 
CheckConditionsAction and does the job of the original execute method.

I don't like this approach for two reasons:
1. it changes the way Action is used, and
2. it only works for action forwards with associated classes (i.e. it doesn't work for 
action forwards defined in struts-config.xml without a type attribute)

Any suggestions would be greatly appreciated.

TIA

Russell


 -------------------------------
 This email message and any attachment(s) is intended only for the 
 person(s) or entity(entities) to whom it is addressed. The 
 information it contains may be classified as IN CONFIDENCE and may be
 legally privileged. If you are not the intended recipient any use,
 disclosure or copying of the message or attachment(s) is strictly 
 prohibited. If you have received this message in error please 
 notify us immediately and destroy it and any attachment(s).
 Thank you. The Ministry of Social Development accepts no
 responsibility for changes made to this message or to any
 attachment(s) after transmission from the Ministry.
 -------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org