While you can use a filter to do this, why not extend the RequestProcessor class?

By overriding the processPreprocess function you can check for your flag. If found simply return true to continue processing. Otherwise forward the user onto the login page.

*
*James Adams wrote:

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]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to