You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by shoaib <sh...@vmoksha.com> on 2003/06/05 11:37:13 UTC

RE: problems tracking session from page to page

You have to create a session object first.
 
Regards
shoaib

-----Original Message-----
From: Mike Lenyon [mailto:mike@lenyon.com] 
Sent: Tuesday, May 27, 2003 9:38 AM
To: cocoon-users@xml.apache.org
Subject: Re: problems tracking session from page to page


shoaib,
 
thanks for your response.  the context in which i'm trying to use the
session object is xsp.  unfortunately, merely starting my xsp with


<xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:xsp-request="http://apache.org/xsp/request/2.0"
    xmlns:xsp-session="http://apache.org/xsp/session/2.0">
 
causes the error message:
java.lang.IllegalStateException: Cannot create a session after the
response has been committed
    
Mike Lenyon

----- Original Message ----- 
From: shoaib <ma...@vmoksha.com>  
To: cocoon-users@xml.apache.org 
Sent: Monday, May 26, 2003 9:16 PM
Subject: RE: problems tracking session from page to page

Why dont you use XSP and then use session object of XSP just as you use
in normal case of JSP page.
 
Regards
Shoaib

-----Original Message-----
From: Mike Lenyon [mailto:mike@lenyon.com] 
Sent: Tuesday, May 27, 2003 4:53 AM
To: cocoon-users@xml.apache.org
Subject: problems tracking session from page to page


hi all,
 
i'm a cocoon newbie.  i created a couple of pages that store values in
the session.  i've tried retrieving those values from the session with
calls like request.getSession(), but i get an error each time i make
such a call:  "Cannot create a session after the response has been
committed."
 
so i think, ok, cocoon will track the session for me from page to page.
all i need to do is use tags like this:


<xsp-request:set-attribute name="current-quote">
    <xsp:expr>currentQuote</xsp:expr>
</xsp-request:set-attribute>

and this:
 
<xsp-request:get-attribute name="current-quote"/>
 
unfortunately, what i've found is that no state is maintained from page
to page just using the above tags.
 
in the past, using servlets and jsp, i was accustomed to getting the
session (by calling request.getSession()) whenever i was ready and
storing objects in it and retrieving objects from it.  but with cocoon,
i get the afforementioned error each time i call request.getSession().
 
what am i doing wrong?  what's a better way to track the session from
one page to the next?  there are multiple points of entry into my
website and i would like to avoid redirecting users to a page where a
session gets created.
 
thanks in advance for your help.
 
Mike Lenyon


RE: problems tracking session from page to page

Posted by Geoff Howard <co...@leverageweb.com>.
which you can do with the create-session="true" attribute on xsp:page.  see 
the docs.

Geoff

At 05:37 AM 6/5/2003, you wrote:
>You have to create a session object first.
>
>Regards
>shoaib
>-----Original Message-----
>From: Mike Lenyon [mailto:mike@lenyon.com]
>Sent: Tuesday, May 27, 2003 9:38 AM
>To: cocoon-users@xml.apache.org
>Subject: Re: problems tracking session from page to page
>
>shoaib,
>
>thanks for your response.  the context in which i'm trying to use the 
>session object is xsp.  unfortunately, merely starting my xsp with
>
><xsp:page
>     language="java"
>     xmlns:xsp="<http://apache.org/xsp>http://apache.org/xsp"
> 
>xmlns:xsp-request="<http://apache.org/xsp/request/2.0>http://apache.org/xsp/request/2.0"
> 
>xmlns:xsp-session="<http://apache.org/xsp/session/2.0>http://apache.org/xsp/session/2.0">
>
>causes the error message:
>java.lang.IllegalStateException: Cannot create a session after the 
>response has been committed
>
>Mike Lenyon
>----- Original Message -----
>From: <ma...@vmoksha.com>shoaib
>To: <ma...@xml.apache.org>cocoon-users@xml.apache.org
>Sent: Monday, May 26, 2003 9:16 PM
>Subject: RE: problems tracking session from page to page
>
>Why dont you use XSP and then use session object of XSP just as you use in 
>normal case of JSP page.
>
>Regards
>Shoaib
>-----Original Message-----
>From: Mike Lenyon [mailto:mike@lenyon.com]
>Sent: Tuesday, May 27, 2003 4:53 AM
>To: <ma...@xml.apache.org>cocoon-users@xml.apache.org
>Subject: problems tracking session from page to page
>
>hi all,
>
>i'm a cocoon newbie.  i created a couple of pages that store values in the 
>session.  i've tried retrieving those values from the session with calls 
>like request.getSession(), but i get an error each time i make such a 
>call:  "Cannot create a session after the response has been committed."
>
>so i think, ok, cocoon will track the session for me from page to 
>page.  all i need to do is use tags like this:
>
><xsp-request:set-attribute name="current-quote">
>     <xsp:expr>currentQuote</xsp:expr>
></xsp-request:set-attribute>
>and this:
>
><xsp-request:get-attribute name="current-quote"/>
>
>unfortunately, what i've found is that no state is maintained from page to 
>page just using the above tags.
>
>in the past, using servlets and jsp, i was accustomed to getting the 
>session (by calling request.getSession()) whenever i was ready and storing 
>objects in it and retrieving objects from it.  but with cocoon, i get the 
>afforementioned error each time i call request.getSession().
>
>what am i doing wrong?  what's a better way to track the session from one 
>page to the next?  there are multiple points of entry into my website and 
>i would like to avoid redirecting users to a page where a session gets created.
>
>thanks in advance for your help.
>
>Mike Lenyon


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org