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 < 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 [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]>