Try using the present tag since you inserted an object into the session for
a valid user. If you are using the standard container security, then declare
those pages in web.xml. The container does the rest for logging in. You may
want to check for the presence of other beans used on the page and redirect
to an action to populate those before displaying.

<logic:notPresent name="loginID">
   <logic:redirect href="/login"/>
</logic:notPresent>

-----Original Message-----
From: Becky Moyer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 9:53 AM
To: [EMAIL PROTECTED]
Subject: Redirect fails in templates


I am trying to redirect a user to the login page if they bookmark a page and

don't have the right authorization when they access it.  Essentailly, once 
someone is securely logged in, I store an object in the session - it's 
presence proves they are logged in.  If it isn't there, then they should be 
redirected.  I put the logic in my actual page, it works.  If I put it in 
the body of my template (since I want it on every page) it can't redirect.  
Why?  I know that the redirect code gets executed, but I either end up 
seeing the page i wanted to access, or I end up seeing a blank page.  I've 
tried the following tags:

<html:redirect page="/login.jsp" />

<% response.sendRedirect("/login.jsp"); %>

<html:forward name="loginpage" /> where the ActionForward that refers to is:
<forward name="loginpage" path="/login.jsp" redirect="true" />

Any thoughts?  My workaround now is to put the tag in each page 
individually, but I'd really like to be able to put it in my templates.

Thanks!
Becky


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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

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

Reply via email to