|
Hi all,
I want to implement a rather classical type of
webapp where the user browses a catalog, adds items to its shopping cart, and
logs in or registers when he's ready to buy the items from his
cart.
I browsed through the mailing list archive and it
seems I could proceed using the session transformer.
Here's a snippet of my sitemap :
<map:pipeline>
<map:match pattern="add_item/*"> <map:generate src=""/> <map:transform src=""> <map:parameter name="item_id" value="{1}"/> </map:transform> <map:transform type="session"/> <map:serialize> </map:match> </map:pipeline> The cart.xml is :
<?xml version="1.0"
encoding="ISO-8859-1"?>
<cart/> And this
is the create_context.xsl :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:session="http://cocoon.apache.org/session/1.0"> <xsl:param name="item_id"/>
<xsl:template
match="cart">
<resource xmlns:session="http://cocoon.apache.org/session/1.0"> <session:createcontext name="mycart"/> <session:setxml context="mycart" path="/"> <cart> <item_id><xsl:value-of select="$item_id"/></item_id> </cart> </session:setxml> <session:getxml context="mycart" path="/"/> </resource> </xsl:template> </xsl:stylesheet> I then try to access the context data using
the following xsp in a different pipeline :
<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0"> <message> <xsp-session-fw:getxml context="mycart" path="/"/> </message> </xsp:page> But I get an error with the following message :
"org.apache.cocoon.ProcessingException: SessionManager.getContextFragment:
Context 'mycart' not found."
Aside from knowing where the error might come from,
I'd like to know if this seems a correct way to proceed to store user data while
he's not logged yet.
many many thanks for your thoughts!
Cheers,
Julien
|
- Re: shopping cart : creating a new context julien bloit
- Re: shopping cart : creating a new context leo leonid
- Re: shopping cart : creating a new context julien bloit
- RE: shopping cart : creating a new context Peter Dietz
- Re: shopping cart : creating a new contex... julien bloit
- RE: shopping cart : creating a new c... Matthew Langham
- Re: shopping cart : creating a n... julien bloit
- RE: shopping cart : creating... Matthew Langham
- Re: shopping cart : creating... julien bloit
- RE: shopping cart : creating... gounis
- Re: shopping cart : creating... julien bloit
