That's what I am doing already...
When I put these tags in my template.jsp page:
<logic:notPresent name="securityObject">
    <logic:redirect page="/login.jsp"/>
</logic:notPresent>

They do not redirect if the securityObject is not present.

If I put them in entry.jsp below...

<logic:notPresent name="securityObject">
  <logic:redirect page="/login.jsp"/>
</logic:notPresent>

<template:insert template='/templates/template.jsp'>
  <template:put name='content' content='/entry_content.jsp'/>
</template:insert>

They work fine.  What is it about the template.jsp page that keeps it from 
being able to redirect?

Thanks,
Becky

----Original Message Follows----
From: "Nguyen, Khuong" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: RE: Redirect fails in templates
Date: Tue, 13 Nov 2001 11:21:40 -0500

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]>



_________________________________________________________________
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]>

Reply via email to