I use a a Servlet Filter to achieve this. This filter intercepts request before Struts gets it's hands on the request.
Paul > -----Original Message----- > From: James Adams [mailto:[EMAIL PROTECTED] > Sent: 19 February 2004 18:17 > To: [EMAIL PROTECTED] > Subject: How to create a "No Action" ActionForward for return from an > Action's execute() ? > > > I have created an Action class which does session > validation by checking to see if a "loggedIn" flag is > set in the session - if it is absent, or set to false, > then I want to forward to the login page. However if > it is set to true then I don't want to do anything - > the execute() method should just complete and control > should return to the calling page. But the execute() > method must return an ActionForward, and it is > impossible to specify a forward name/path for this > case in the struts-config.xml since the path should be > the path of the page that the action is being called > from, and there is no way to know this information > beforehand. So I am wondering how can I (within the > execute() method of the SessionValidatorAction) create > an ActionForward to return which will indicate the > path of the calling page ? Is there a way to create > and return a "No Action" ActionForward ? Can I just > return null ? > > I am including the action at the top of the JSPs via > > > <jsp:include page="SessionValidator"/> > > > The action mapping I'm currently using looks like this > > > <action path="/SessionValidator" > type="mypkg.action.SessionValidatorAction"> > <forward name="invalid" > path="Login.jsp"/> > <!-- it's here that I'd specify the path to forward to > when the session is valid, but I can't know this path > beforehand, since the validator is being included in > multiple pages --> > </action> > > > Is this the right approach/design ? If so how can I > return an ActionForward from the > SessionValidatorAction's execute() method which > forwards control back to the calling page ? If not > then how else should I go about this ? > > Thanks in advance for your feedback. Please Cc: any > rsponses to this email address. > > > -James > > __________________________________ > Do you Yahoo!? > Yahoo! Mail SpamGuard - Read only the mail you want. > http://antispam.yahoo.com/tools > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ************************************** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

