cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cyril Vidal" <cy...@planetexml.com>
Subject Re: variable i not found in XSP!
Date Thu, 06 Feb 2003 16:54:51 GMT
Thanks  for your help Chris!
It's working fine now!

Cyril.


> On 06.Feb.2003 -- 05:09 PM, Cyril Vidal wrote:
> > Hi,
> >
> > Since yesterday, I'm still stuck on the following problem: I can't list
the
> > items contained in a session's attribute of type Vector:
> > Always the same following error is thrown:
> > Line 236, column 59:  variable i not found in class
> > org.apache.cocoon.www.mount.essai.session3_xsp
> >
> > Below is my code:
> > <?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">
> >
> > <xsp:structure>
> >
> > <xsp:include>java.util.Vector</xsp:include>
> >
> > </xsp:structure>
> >
> > <content>
> >
> > <xsp:logic>
> >
> > Vector items = (Vector)<xsp-session:get-attribute name="cart.items"/>;
> >
> > if (items == null) items = new Vector(10,5);
> >
> > items.add(<xsp-request:get-parameter name="item"/>);
> >
> > session.setAttribute("cart.items",items);
> >
> > if (!<xsp-session:is-new/>) {
> >
> > <ul>
>
>   When nesting logic inside markup inside logic, new xsp:logic tags
>   are needed! IOW, you can put markup inside logic without manually
>   switching to e.g. text mode. That is done automatically. But once
>   you are in text mode, logic needs to be escaped again. HTH.
>
>   <xsp:logic>
>
> > for (int i = 0; i &lt; items.size(); i++) {
> >
> > <li><xsp:expr>items.get(i)</xsp:expr></li>
> >
> > }
>
>   </xsp:logic>
>
> > </ul>
> >
> > }
> >
> >
> > </xsp:logic>
> >
> > </content>
> >
> > </xsp:page>
>
> 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:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
>
>



---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message