You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mike Lenyon <mi...@lenyon.com> on 2003/05/26 22:52:37 UTC

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


Re: problems tracking session from page to page

Posted by Geoff Howard <co...@leverageweb.com>.
I'd have to look into the code to figure out exactly _why_ this happened,
but my understanding is that the start of generating "commits" the response.
Exactly what constitutes the "start" I don't know off hand, but my guess
would be when the SAX method startDocument() is called on the pipeline.
You get the same error I think if you omit the create-session attribute on
a simple one-xsp pipeline that uses session code inside the root element.

HTH,
Geoff

At 02:14 AM 5/28/2003, you wrote:
>geoff,
>
>you're right!  i moved the create-session attribute to the first map:part in
>the aggregation you saw in my example.  i did the same in another nearly
>identical aggregation in my sitemap.  now i'm able to access the session
>from within the particular map:part where i wanted to in the first place.
>
>i don't quite understand why this change made it work, though.  my only
>clues are:
>
>1.)  by accessing the session in the first map:part, i've somehow enabled
>session access in a later map:part that otherwise wouldn't have
>been able to access the session successfully.
>
>2.)  the IllegalStateException was telling me that i "Cannot create a
>session
>after the response has been committed."
>
>each map:part invokes a matcher similar to this one:
>
><map:match pattern="choose_item.products">
>     <map:generate type="serverpages" src="xsp/choose_item.products.xsp"/>
>     <map:serialize type="xml"/>
></map:match>
>
>does the map:serialize "commit" the response?  is that what the error
>message is
>talking about?
>
>thanks!
>
>Mike Lenyon
>----- Original Message -----
>From: "Geoff Howard" <co...@leverageweb.com>
>To: <co...@xml.apache.org>
>Sent: Tuesday, May 27, 2003 12:10 PM
>Subject: Re: problems tracking session from page to page
>
>
> > I think the issue is the aggregation.  to test, go directly to the
> > general.currentproduct pipeline (with the create-session attr. in).
> > If that works, try to move it to the first map:part if you can as
> > a workaround.  A better solution would be to look into the session
> > actions that will ensure you have created your session before the
> > pipeline starts generating.
> >
> > HTH,
> > Geoff
> >
> > At 08:56 AM 5/27/2003, you wrote:
> > >hi geoff,
> > >
> > >yes, i've tried putting create-session in the xsp:page tag.  but i still
>get
> > >the IllegalStateException.  as you're probably aware, having
>create-session
> > >causes the following line to appear at the beginning of the generate()
> > >method:
> > >
> > >Session session = request.getSession(true);
> > >
> > >that's the line that the exception refers to.
> > >
> > >here's a snippet from my sitemap to exemplify one of the two pages where
>to
> > >problem occurs:
> > >
> > >             <map:match pattern="choose_item.html">
> > >                 <map:aggregate element="page">
> > >                     <map:part src="cocoon:/choose_item.products"/>
> > >                     <map:part src="cocoon:/general.productcategories"/>
> > >                     <map:part src="cocoon:/common"/>
> > >                     <map:part src="cocoon:/general.currentproduct"/>
><!--
> > >only page that accesses session -->
> > >                 </map:aggregate>
> > >                 <map:transform type="xslt" src="style/choose_item.xsl"/>
> > >                 <map:transform type="i18n"/>
> > >                 <map:serialize type="html"/>
> > >             </map:match>
> > >
> > >does that provide any useful clues?
> > >
> > >thanks in advance.
> > >
> > >Mike Lenyon
> > >----- Original Message -----
> > >From: "Geoff Howard" <co...@leverageweb.com>
> > >To: <co...@xml.apache.org>
> > >Sent: Tuesday, May 27, 2003 8:22 AM
> > >Subject: Re: problems tracking session from page to page
> > >
> > >
> > > > But I think the problem is that your code is working with the
> > > > session after processing starts and attempting there to create
> > > > a session after it's too late.  Have you tried the create-session
> > > > attribute yet?
> > > >
> > > > Geoff Howard
> > > >
> > > > At 07:05 AM 5/27/2003, you wrote:
> > > > >antonio,
> > > > >
> > > > >thanks for your response, but please look at what i'm saying:
> > > > >
> > > > ><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
> > > > >
> > > > >in other words, not having create-session="true" doesn't matter.
>simply
> > > > >having
> > > > >     xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
> > > > >problem.
> > > > >
> > > > >Mike Lenyon
> > > > >----- Original Message -----
> > > > >From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
> > > > >To: <co...@xml.apache.org>
> > > > >Sent: Tuesday, May 27, 2003 1:49 AM
> > > > >Subject: Re: problems tracking session from page to page
> > > > >
> > > > >
> > > > > > Hi:
> > > > > >
> > > > > > I dont remember if changed from default. Before the default was
>create
> > >a
> > > > > > new session. Now I think this is not the default.
> > > > > >
> > > > > > Please try to use:
> > > > > > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> > > > >create-session="true"
> > > > > >
> > > > > > Best Regards,
> > > > > >
> > > > > > Antonio Gallardo
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >---------------------------------------------------------------------
> > > > >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > >
> > > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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


Re: problems tracking session from page to page

Posted by Mike Lenyon <mi...@lenyon.com>.
geoff,

you're right!  i moved the create-session attribute to the first map:part in
the aggregation you saw in my example.  i did the same in another nearly
identical aggregation in my sitemap.  now i'm able to access the session
from within the particular map:part where i wanted to in the first place.

i don't quite understand why this change made it work, though.  my only
clues are:

1.)  by accessing the session in the first map:part, i've somehow enabled
session access in a later map:part that otherwise wouldn't have
been able to access the session successfully.

2.)  the IllegalStateException was telling me that i "Cannot create a
session
after the response has been committed."

each map:part invokes a matcher similar to this one:

<map:match pattern="choose_item.products">
    <map:generate type="serverpages" src="xsp/choose_item.products.xsp"/>
    <map:serialize type="xml"/>
</map:match>

does the map:serialize "commit" the response?  is that what the error
message is
talking about?

thanks!

Mike Lenyon
----- Original Message -----
From: "Geoff Howard" <co...@leverageweb.com>
To: <co...@xml.apache.org>
Sent: Tuesday, May 27, 2003 12:10 PM
Subject: Re: problems tracking session from page to page


> I think the issue is the aggregation.  to test, go directly to the
> general.currentproduct pipeline (with the create-session attr. in).
> If that works, try to move it to the first map:part if you can as
> a workaround.  A better solution would be to look into the session
> actions that will ensure you have created your session before the
> pipeline starts generating.
>
> HTH,
> Geoff
>
> At 08:56 AM 5/27/2003, you wrote:
> >hi geoff,
> >
> >yes, i've tried putting create-session in the xsp:page tag.  but i still
get
> >the IllegalStateException.  as you're probably aware, having
create-session
> >causes the following line to appear at the beginning of the generate()
> >method:
> >
> >Session session = request.getSession(true);
> >
> >that's the line that the exception refers to.
> >
> >here's a snippet from my sitemap to exemplify one of the two pages where
to
> >problem occurs:
> >
> >             <map:match pattern="choose_item.html">
> >                 <map:aggregate element="page">
> >                     <map:part src="cocoon:/choose_item.products"/>
> >                     <map:part src="cocoon:/general.productcategories"/>
> >                     <map:part src="cocoon:/common"/>
> >                     <map:part src="cocoon:/general.currentproduct"/>
<!--
> >only page that accesses session -->
> >                 </map:aggregate>
> >                 <map:transform type="xslt" src="style/choose_item.xsl"/>
> >                 <map:transform type="i18n"/>
> >                 <map:serialize type="html"/>
> >             </map:match>
> >
> >does that provide any useful clues?
> >
> >thanks in advance.
> >
> >Mike Lenyon
> >----- Original Message -----
> >From: "Geoff Howard" <co...@leverageweb.com>
> >To: <co...@xml.apache.org>
> >Sent: Tuesday, May 27, 2003 8:22 AM
> >Subject: Re: problems tracking session from page to page
> >
> >
> > > But I think the problem is that your code is working with the
> > > session after processing starts and attempting there to create
> > > a session after it's too late.  Have you tried the create-session
> > > attribute yet?
> > >
> > > Geoff Howard
> > >
> > > At 07:05 AM 5/27/2003, you wrote:
> > > >antonio,
> > > >
> > > >thanks for your response, but please look at what i'm saying:
> > > >
> > > ><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
> > > >
> > > >in other words, not having create-session="true" doesn't matter.
simply
> > > >having
> > > >     xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
> > > >problem.
> > > >
> > > >Mike Lenyon
> > > >----- Original Message -----
> > > >From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
> > > >To: <co...@xml.apache.org>
> > > >Sent: Tuesday, May 27, 2003 1:49 AM
> > > >Subject: Re: problems tracking session from page to page
> > > >
> > > >
> > > > > Hi:
> > > > >
> > > > > I dont remember if changed from default. Before the default was
create
> >a
> > > > > new session. Now I think this is not the default.
> > > > >
> > > > > Please try to use:
> > > > > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> > > >create-session="true"
> > > > >
> > > > > Best Regards,
> > > > >
> > > > > Antonio Gallardo
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>



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


Re: problems tracking session from page to page

Posted by Geoff Howard <co...@leverageweb.com>.
I think the issue is the aggregation.  to test, go directly to the
general.currentproduct pipeline (with the create-session attr. in).
If that works, try to move it to the first map:part if you can as
a workaround.  A better solution would be to look into the session
actions that will ensure you have created your session before the
pipeline starts generating.

HTH,
Geoff

At 08:56 AM 5/27/2003, you wrote:
>hi geoff,
>
>yes, i've tried putting create-session in the xsp:page tag.  but i still get
>the IllegalStateException.  as you're probably aware, having create-session
>causes the following line to appear at the beginning of the generate()
>method:
>
>Session session = request.getSession(true);
>
>that's the line that the exception refers to.
>
>here's a snippet from my sitemap to exemplify one of the two pages where to
>problem occurs:
>
>             <map:match pattern="choose_item.html">
>                 <map:aggregate element="page">
>                     <map:part src="cocoon:/choose_item.products"/>
>                     <map:part src="cocoon:/general.productcategories"/>
>                     <map:part src="cocoon:/common"/>
>                     <map:part src="cocoon:/general.currentproduct"/> <!--
>only page that accesses session -->
>                 </map:aggregate>
>                 <map:transform type="xslt" src="style/choose_item.xsl"/>
>                 <map:transform type="i18n"/>
>                 <map:serialize type="html"/>
>             </map:match>
>
>does that provide any useful clues?
>
>thanks in advance.
>
>Mike Lenyon
>----- Original Message -----
>From: "Geoff Howard" <co...@leverageweb.com>
>To: <co...@xml.apache.org>
>Sent: Tuesday, May 27, 2003 8:22 AM
>Subject: Re: problems tracking session from page to page
>
>
> > But I think the problem is that your code is working with the
> > session after processing starts and attempting there to create
> > a session after it's too late.  Have you tried the create-session
> > attribute yet?
> >
> > Geoff Howard
> >
> > At 07:05 AM 5/27/2003, you wrote:
> > >antonio,
> > >
> > >thanks for your response, but please look at what i'm saying:
> > >
> > ><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
> > >
> > >in other words, not having create-session="true" doesn't matter.  simply
> > >having
> > >     xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
> > >problem.
> > >
> > >Mike Lenyon
> > >----- Original Message -----
> > >From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
> > >To: <co...@xml.apache.org>
> > >Sent: Tuesday, May 27, 2003 1:49 AM
> > >Subject: Re: problems tracking session from page to page
> > >
> > >
> > > > Hi:
> > > >
> > > > I dont remember if changed from default. Before the default was create
>a
> > > > new session. Now I think this is not the default.
> > > >
> > > > Please try to use:
> > > > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> > >create-session="true"
> > > >
> > > > Best Regards,
> > > >
> > > > Antonio Gallardo
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > > >
> > > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > >For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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


Re: problems tracking session from page to page

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Geoff Howard dijo:
> But I think the problem is that your code is working with the
> session after processing starts and attempting there to create
> a session after it's too late.  Have you tried the create-session
> attribute yet?

Good point Geoff, Is the XSP page used as generator<or XSP-Action?

Antonio Gallardo




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


Re: problems tracking session from page to page

Posted by Mike Lenyon <mi...@lenyon.com>.
hi geoff,

yes, i've tried putting create-session in the xsp:page tag.  but i still get
the IllegalStateException.  as you're probably aware, having create-session
causes the following line to appear at the beginning of the generate()
method:

Session session = request.getSession(true);

that's the line that the exception refers to.

here's a snippet from my sitemap to exemplify one of the two pages where to
problem occurs:

            <map:match pattern="choose_item.html">
                <map:aggregate element="page">
                    <map:part src="cocoon:/choose_item.products"/>
                    <map:part src="cocoon:/general.productcategories"/>
                    <map:part src="cocoon:/common"/>
                    <map:part src="cocoon:/general.currentproduct"/> <!--
only page that accesses session -->
                </map:aggregate>
                <map:transform type="xslt" src="style/choose_item.xsl"/>
                <map:transform type="i18n"/>
                <map:serialize type="html"/>
            </map:match>

does that provide any useful clues?

thanks in advance.

Mike Lenyon
----- Original Message -----
From: "Geoff Howard" <co...@leverageweb.com>
To: <co...@xml.apache.org>
Sent: Tuesday, May 27, 2003 8:22 AM
Subject: Re: problems tracking session from page to page


> But I think the problem is that your code is working with the
> session after processing starts and attempting there to create
> a session after it's too late.  Have you tried the create-session
> attribute yet?
>
> Geoff Howard
>
> At 07:05 AM 5/27/2003, you wrote:
> >antonio,
> >
> >thanks for your response, but please look at what i'm saying:
> >
> ><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
> >
> >in other words, not having create-session="true" doesn't matter.  simply
> >having
> >     xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
> >problem.
> >
> >Mike Lenyon
> >----- Original Message -----
> >From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
> >To: <co...@xml.apache.org>
> >Sent: Tuesday, May 27, 2003 1:49 AM
> >Subject: Re: problems tracking session from page to page
> >
> >
> > > Hi:
> > >
> > > I dont remember if changed from default. Before the default was create
a
> > > new session. Now I think this is not the default.
> > >
> > > Please try to use:
> > > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> >create-session="true"
> > >
> > > Best Regards,
> > >
> > > Antonio Gallardo
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> >For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


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


Re: problems tracking session from page to page

Posted by Geoff Howard <co...@leverageweb.com>.
But I think the problem is that your code is working with the
session after processing starts and attempting there to create
a session after it's too late.  Have you tried the create-session
attribute yet?

Geoff Howard

At 07:05 AM 5/27/2003, you wrote:
>antonio,
>
>thanks for your response, but please look at what i'm saying:
>
><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
>
>in other words, not having create-session="true" doesn't matter.  simply
>having
>     xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
>problem.
>
>Mike Lenyon
>----- Original Message -----
>From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
>To: <co...@xml.apache.org>
>Sent: Tuesday, May 27, 2003 1:49 AM
>Subject: Re: problems tracking session from page to page
>
>
> > Hi:
> >
> > I dont remember if changed from default. Before the default was create a
> > new session. Now I think this is not the default.
> >
> > Please try to use:
> > xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>create-session="true"
> >
> > Best Regards,
> >
> > Antonio Gallardo
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: cocoon-users-help@xml.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org


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


Re: problems tracking session from page to page

Posted by Mike Lenyon <mi...@lenyon.com>.
antonio,

thanks for your response, but please look at what i'm saying:

<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

in other words, not having create-session="true" doesn't matter.  simply
having
    xmlns:xsp-session="http://apache.org/xsp/session/2.0" causes the
problem.

Mike Lenyon
----- Original Message -----
From: "Antonio Gallardo" <ag...@agsoftware.dnsalias.com>
To: <co...@xml.apache.org>
Sent: Tuesday, May 27, 2003 1:49 AM
Subject: Re: problems tracking session from page to page


> Hi:
>
> I dont remember if changed from default. Before the default was create a
> new session. Now I think this is not the default.
>
> Please try to use:
> xmlns:xsp-session="http://apache.org/xsp/session/2.0"
create-session="true"
>
> Best Regards,
>
> Antonio Gallardo
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
>


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


Re: problems tracking session from page to page

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Hi:

I dont remember if changed from default. Before the default was create a
new session. Now I think this is not the default.

Please try to use:
xmlns:xsp-session="http://apache.org/xsp/session/2.0" create-session="true"

Best Regards,

Antonio Gallardo




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


RE: problems tracking session from page to page

Posted by shoaib <sh...@vmoksha.com>.
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 Mike Lenyon <mi...@lenyon.com>.
Messageshoaib,

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 
  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 shoaib <sh...@vmoksha.com>.
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