cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Maloney <coc...@chrismaloney.com>
Subject Re: FOR-loop in xsp:logic section
Date Mon, 16 May 2005 12:06:19 GMT
Try wrapping your "xsp:logic" in some other element, like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
   xmlns:xsp-request="http://apache.org/xsp/request/2.0"
   xmlns:xsp-session="http://apache.org/xsp/session/2.0"
   xmlns:esql="http://apache.org/cocoon/SQL/v2"
   create-session="true">
   <xsp:structure>
   </xsp:structure>
  <OtherElement>
   <xsp:logic>
           for (int i=0;i&lt; 9; i++){
               i=i+1;
           }
   </xsp:logic>
  </OtherElement>
</xsp:page>

FWIW, it can help in debugging XSP problems to examine the ".java" file 
that gets created.  I'm using Cocoon 2.1.5.1, and that puts these 
generated .java files into 
build/webapp/WEB-INF/work/cocoon-files/org/apache/cocoon/www/....  I 
think, in later versions, it puts them somewhere else, under a system 
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 
> logic section a FOR loop.
> Everything works fine, only the FOR loop doesn't work. Here is my 
> simple code:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>    xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>    xmlns:xsp-session="http://apache.org/xsp/session/2.0"
>    xmlns:esql="http://apache.org/cocoon/SQL/v2"
>    create-session="true">
>    <xsp:structure>
>    </xsp:structure>
>    <xsp:logic>
>            for (int i=0;i&lt; 9; i++){
>                i=i+1;
>            }
>    </xsp:logic>
> </xsp:page>
>
> I get the following error when calling the xsp-page:
>
>> Error compiling getStatement_xsp: ERROR 1 
>> (org\apache\cocoon\www\apples\xsp\getStatement_xsp.java): ... 
>> XSPObjectHelper.xspExpr(contentHandler, obj); ; } // start error 
>> (lines 237-237) "Syntax error on token "}", { expected after this 
>> token" } // end error for (int i=0;i< 9; i++) i=i+1; ... ERROR 2 
>> (org\apache\cocoon\www\apples\xsp\getStatement_xsp.java): ... ; } } 
>> // start error (lines 239-239) "Syntax error on token(s), misplaced 
>> construct(s)" for (int i=0;i< 9; i++) // end error i=i+1; /** ... 
>> Line 237, column 0: Syntax error on token "}", { expected after this 
>> token Line 239, column 0: Syntax error on token(s), misplaced 
>> construct(s)
>
>
>
> My question is. How can I include a FOR or a WHILE loop in the 
> xsp:logic section?
>
> Thanks for help in advance
>
> Michael Milvich
>
> --------------------------------------------------------------------- 
> 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


Mime
View raw message