I extended the RequestProcessor to forward between two web applications. The 
following code is what I use to forward to an action that the other web 
application has. Then the other web application can define an action that can 
handle forwarding to whatever jsp it wants.
if (forward.getName().startsWith("common_"))
{
getServletContext().getContext("/thinClient/common.do").getRequestDispatcher("/common.do").forward(request,response);
 
return;
}
Scott

 



From: [EMAIL PROTECTED]
Sent: Thu 7/14/2005 10:37 AM
To: user@struts.apache.org
Subject: Forwarding in custom RequestProcessor


Hi!

I have extended the RequestProcessor's processPreprocess() method
in order to perform a simple user authentication mechanism using
cookies. If a cookie identifying a user is found, but the users member-
ship has expired, I would like him to be forwarded/redirected to a
corresponding error page. What is the best way to do this? I tried
the following:

request.getRequestDispatcher( "membershipExpired.jsp" ).forward( request,
response );

which works fine. But this is surely not how struts should work because
I have hardcoded the target in my code, and not configured in my
struts-config.xml for example. So if the error page changes I have to
chnage my code and not only the struts-config.xml. Does anybody know
a better solution? I tried a global-forward like this but it didn't work:

<global-forwards>
    <forward name="nodb" path="/membershipExpired.jsp" />
</global-forwards>

with

request.getRequestDispatcher( "nodb" ).forward( request, response );

Perhaps I made a mistake somewhere...

Peter


--------------------------------------------------

MATERNA GmbH Information & Communications
Vosskuhle 37
44141 Dortmund
Tel:  +49-231-5599-8868
Fax: +49-231-5599-678868

[EMAIL PROTECTED]
www.annyway.de        www.materna.de
www.annyway.com      www.materna.com

Visit us at the following events:
ACI EUROPE, Munich
June, 22 - 24, 2005

ACI EUROPE, Verona
September, 26 - 28, 2005

CTIA Wireless I.T. & Entertainment 2005, San Francisco
September, 27 - 29, 2005

Con4, Cologne
September, 27 - 29, 2005


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

Reply via email to