You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MT...@aol.com on 2002/08/21 10:07:38 UTC

How to send redirect from an XSP?

hello all,

i'm trying to check to see if a user is in a session, and if not, redirect 
them to a login page...

my (rather sloppy) code so far goes like so...

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
  xmlns:session="http://apache.org/xsp/session/2.0"
  xmlns:xsp="http://apache.org/xsp"
  xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  create-session="false">

    <xsp:logic>

    protected void checkUser()
    {
     if(!getSession())
       { 
             //SEND REDIRECT...
         }
    }

    protected boolean getSession()
    {
      Session session=request.getSession(false);
        if(session == null)
        return false;
        else
        return true;
        
    }
    </xsp:logic>

so, anyone care to share with me the secret of sending a redirect? I've 
checked out the response stylesheet and that was of no help, and the action 
stylesheet is apparently "not for use in Generators"...

any and all help (exlcuding RTFM) welcome

Re: How to send redirect from an XSP?

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 21.Aug.2002 -- 04:07 AM, MTiffany71@aol.com wrote:
> hello all,
> 
> i'm trying to check to see if a user is in a session, and if not, redirect 
> them to a login page...

You shouldn't do it. Use an action for this. There are already a
number of actions that perform this job. Use one of them, modify one
of them, write a new one, or write an XSP action that does it.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>