variable i not found in XSP!
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:includejava.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); the snippet below works fine * if (!xsp-session:is-new/) { ul bThe list of items is:/b xsp-session:get-attribute name=cart.items default=not set/ /ul } *** the snippet below doesn't work :-(( * if (!xsp-session:is-new/) { ul for (int i = 0; i lt; items.size(); i++) { lixsp:expritems.get(i)/xsp:expr/li } /ul } /xsp:logic /content /xsp:page SOmeone one can help me, please? Regards, Cyril. - 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]
Re: variable i not found in XSP!
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:includejava.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++) { lixsp:expritems.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]
Re: variable i not found in XSP!
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:includejava.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++) { lixsp:expritems.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] - 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]