You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Vadim Gritsenko <va...@verizon.net> on 2002/07/02 14:39:39 UTC

&& in XSP, was: Multiple conditions in an XSP if statement

> From: Robert Bourdeau [mailto:bourdeau@ciesin.columbia.edu]

Robert,

> I'm very very new to XML, and enjoying it thoroughly, but I have to
admit that
> I find the
> 	&amp;&amp;
> encoding for a logical-and in Java to be extremely nasty looking. It
really
> obfuscates the intended meaning of the statement, requiring the reader
to
> view the "Java"-code contained within a little more indirectly. I have
to
> think
>     " '&amp;&amp;' looks like two ampersands, which would read as
'AND'."
> Maybe you get used to this, but it does begin to spoil the syntax of
the
> underlying programming language.
> 
> I'll now truly reveal my ignorance. Is it not possible to define an
> ENTITY such that  &&   can be used legally? Perhaps not, since it
cannot
> end with the semi-colon. But I can't help but think there MUST be
someway to
> preserve the notational syntax of the Java code.
> 
> Needless to say,
> 	<![CDATA[&&]]>
> leaves me breathless.

<![CDATA[
 ... java code starts ...
 if (x && y) {}
 ... java code ends ...
]]>

PS It is known that lots of java code in the XSP page is not a good
idea. Sometimes there is better place: XSP logicsheet, action, custom
generator or transformer.

Vadim


> --- Bob
> 
> 
> 
> 
> 
> > Beth,
> >     Thanks for the reply. I just found the answer after a search on
> > goggle:
> >
http://lists.w3.org/Archives/Public/www-xpath-comments/1999JulSep/0032.h
> > tml
> >
> >
> > Either:
> >   if( <xsp-session:get-attribute name="state"/> == null &amp;&amp;
> > <xsp-request:get-parameter name="state"/> == null )
> >
> > Or:
> >   if( <xsp-session:get-attribute name="state"/> == null
<![CDATA[&&]]>
> > <xsp-request:get-parameter name="state"/> == null )
> >
> > works fine.
> >
> > When I tried putting <![CDATA[ ...if statement with tags... ]]>
> >
> > it failed with the following error:
> >
> > org.apache.cocoon.ProcessingException: Language Exception:
> > org.apache.cocoon.components.language.LanguageException: Error
compiling
> > form_xsp:
> > ERROR 1 (D:\apps\Tomcat
> >
4.1\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/
> > eval/logic\form_xsp.java):
> > ...
> 


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