Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 85282 invoked from network); 17 May 2005 19:22:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 May 2005 19:22:33 -0000 Received: (qmail 26115 invoked by uid 500); 17 May 2005 15:24:01 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 26009 invoked by uid 500); 17 May 2005 15:23:59 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 25969 invoked by uid 99); 17 May 2005 15:23:58 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from ns0b.swx.com (HELO ns0b.swx.com) (146.109.240.235) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 17 May 2005 08:23:56 -0700 Received: from gate0b.unix.swx.ch (gate0b [192.168.252.145]) by ns0b.swx.com (8.12.10/8.12.10) with ESMTP id j4HFJkg6023561 for ; Tue, 17 May 2005 17:19:46 +0200 (MEST) Received: from CIWMEXZSA0E.ex.ordersx.org (localhost [127.0.0.1]) by gate0b.unix.swx.ch (8.12.10/8.12.10) with ESMTP id j4HFJkme006669 for ; Tue, 17 May 2005 17:19:46 +0200 (MEST) Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Importance: normal Priority: normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 Subject: RE: FOR-loop in xsp:logic section Date: Tue, 17 May 2005 17:19:45 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: FOR-loop in xsp:logic section thread-index: AcVa767G8jllieSMQfGKUvqQES5xSAAAngnQ From: "Nathaniel Alfred" To: X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N The content of as immediate child of is inserted into the class scope and can therefore be used to define private methods and variables. For variables one has to be aware that the compiled XSP will be = recycled, and initializations will not be repeated. A classic error is that java.util.Date Date now =3D new Date(); String formatDate(Date date) { return date.toString(); } formatDate(now) prints the date when the XSP is compiled, and not when it is called. HTH, Alfred. -----Original Message----- From: Michael Milvich [mailto:m.milvich@gmx.de] Sent: Montag, 16. Mai 2005 18:51 To: users@cocoon.apache.org Subject: Re: FOR-loop in xsp:logic section Hallo, thank you Chris for help. It's working! I also I looked at the created *.java class and found out that cocoon is = doing something strange, when the additional elements are missing. Here=20 is the code: XSPObjectHelper.xspExpr(contentHandler, obj); ; } } for (int i=3D0;i< 9; i++) i=3Di+1; Is this a bug in cocoon? regards Michael Milvich Chris Maloney wrote: > Try wrapping your "xsp:logic" in some other element, like this: > > > xmlns:xsp-request=3D"http://apache.org/xsp/request/2.0" > xmlns:xsp-session=3D"http://apache.org/xsp/session/2.0" > xmlns:esql=3D"http://apache.org/cocoon/SQL/v2" > create-session=3D"true"> > > > > > for (int i=3D0;i< 9; i++){ > i=3Di+1; > } > > > > > FWIW, it can help in debugging XSP problems to examine the ".java"=20 > file that gets created. I'm using Cocoon 2.1.5.1, and that puts these = > generated .java files into=20 > build/webapp/WEB-INF/work/cocoon-files/org/apache/cocoon/www/.... I=20 > think, in later versions, it puts them somewhere else, under a system=20 > temp directory. In your case, search for getStatement_xsp.java (which = > you can see from the error message, is the name of the .java file). > > HTH, > Chris Maloney > > > Michael Milvich wrote: > >> Hallo, >> >> i am using Cocoon 2.1.7, jdk 1.4 and tomcat 5.0.19. >> >> I would like to include in a xsp-page a small logic part and in this=20 >> logic section a FOR loop. >> Everything works fine, only the FOR loop doesn't work. Here is my=20 >> simple code: >> >> >> > xmlns:xsp-request=3D"http://apache.org/xsp/request/2.0" >> xmlns:xsp-session=3D"http://apache.org/xsp/session/2.0" >> xmlns:esql=3D"http://apache.org/cocoon/SQL/v2" >> create-session=3D"true"> >> >> >> >> for (int i=3D0;i< 9; i++){ >> i=3Di+1; >> } >> >> >> >> I get the following error when calling the xsp-page: >> >>> Error compiling getStatement_xsp: ERROR 1=20 >>> (org\apache\cocoon\www\apples\xsp\getStatement_xsp.java): ...=20 >>> XSPObjectHelper.xspExpr(contentHandler, obj); ; } // start error=20 >>> (lines 237-237) "Syntax error on token "}", { expected after this=20 >>> token" } // end error for (int i=3D0;i< 9; i++) i=3Di+1; ... ERROR 2 = >>> (org\apache\cocoon\www\apples\xsp\getStatement_xsp.java): ... ; } }=20 >>> // start error (lines 239-239) "Syntax error on token(s), misplaced=20 >>> construct(s)" for (int i=3D0;i< 9; i++) // end error i=3Di+1; /** = ...=20 >>> Line 237, column 0: Syntax error on token "}", { expected after this = >>> token Line 239, column 0: Syntax error on token(s), misplaced=20 >>> construct(s) >> >> >> >> >> My question is. How can I include a FOR or a WHILE loop in the=20 >> xsp:logic section? >> >> Thanks for help in advance >> >> Michael Milvich >> >> --------------------------------------------------------------------- = >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For=20 >> additional commands, e-mail: users-help@cocoon.apache.org=20 > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org =20 =20 This message is for the named person's use only. It may contain = confidential, proprietary or legally privileged information. No = confidentiality or privilege is waived or lost by any mistransmission. = If you receive this message in error, please notify the sender urgently = and then immediately delete the message and any copies of it from your = system. Please also immediately destroy any hardcopies of the message. = You must not, directly or indirectly, use, disclose, distribute, print, = or copy any part of this message if you are not the intended recipient. = The sender's company reserves the right to monitor all e-mail = communications through their networks. Any views expressed in this = message are those of the individual sender, except where the message = states otherwise and the sender is authorised to state them to be the = views of the sender's company. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org