On 05.Feb.2003 -- 02:56 PM, Cyril Vidal wrote:
> Hello Christian,
>
> Thanks again for your help and your availibility.
> Of course, I meant Session logicsheet and not ESQL one...Sorry...
> I've tried to launch the code you've suggested:
>
> <?xml version="1.0"?>
>
> <xsp:page
>
> xmlns:xsp="http://apache.org/xsp"
>
> xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>
> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>
> create-session="true">
The class Vector is unknown here. Add
<xsp:structure>
<xsp:include>java.util.Vector</xsp:include>
</xsp:structure>
in order to create an import statement.
Add some markup here, otherwise the following code won't be inside the
generate() method but would be expected to be a valid method
declaration.
<content>
>
> <xsp:logic>
>
> Object items = <xsp-session:get-attribute name="cart.items"/>;
>
> if (items == null) items = new Vector(10,5);
>
> ((Vector) items).add(<xsp-request:get-parameter name="item"/>);
>
> request.getSession().setAttribute(items);
>
> // logicsheet only supports setting Strings objects :-(
>
> // thus do it manually.
>
> </xsp:logic>
</content>
> </xsp:page>
> Regards,
> Cyril.
> PS: In the code, you've written:
> request.getSession().setAttribute(items);
>
> shall we not write instead
>
> request.getSession().setAttribute("cart-item", items);
>
> as in the traditional java servlet?
Absolutely, you are right. And the other poster is also right that
there is a variable named "session" if the session logicsheet is
used. Thus it suffices to write
session.setAttribute("cart.items", items);
Chris.
BTW when writing to the list you don't need to CC me -- it will end up
in the same mailbox anyway (as duplicates).
--
C h r i s t i a n H a u l
[EMAIL PROTECTED]
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>