cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Skulborstad <ra...@jak.se>
Subject Re: XSP Problem
Date Mon, 13 Feb 2006 16:01:37 GMT
Derek Harmel wrote:
> Forgive me as I fairly new to Cocoon and have virtually no experience
> with Java.  Don't worry, I'm not going to ask you to write something
> for me.
> 
> Anyway, I have a problem with an XSP that I just cannot figure out. 
> In the code below, if I do not comment out the two 'if statements' and
> the 'else statement', I get a Null Pointer Exception.  However, when I
> do comment those lines out, it seems to compile just fine.  Does
> anyone see what my problem is?
> 
> If "handler" and "repeat" do not exist in the request parameters and
> attributes respectively, could this be causing the problem?
> 
> The exception happens in "ServerPagesGenerator.generate()".  Cocoon v2.1.8.
> 
> Thanks in advance.
> 
> <?xml version="1.0"?>
> 
> <xsp:page
>     language="java"
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:xsp-request=" http://apache.org/xsp/request/2.0"
>     xmlns:action="http://apache.org/cocoon/action/1.0"
> 
> 
>     <check>
>         <xsp:logic>
>             String handler = (String)request.getParameter( "handler" );
>             String repeat  = (String)request.getAttribute( "repeat" );
> 
>             if( handler.length() > 0 )
>             {
>                 if( repeat.length() == 0 || repeat.equals("0") )
>                 {
>                     <action:set-result>
>                         <action:param name="name">handler</action:param>
>                         <action:param
> name="value"><xsp:expr>handler</xsp:expr></action:param>
>                     </action:set-result>
>                     <action:set-success />
>                     <xsp-request:set-attribute
> name="repeat">1</xsp-request:set-attribute>
>                     <handler><xsp:expr>handler</xsp:expr></handler>
>                 }
>             }
>             else
>             {
>                 <action:set-failure />
>                 <xsp-request:set-attribute
> name="repeat">0</xsp-request:set-attribute>
>             }
>         </xsp:logic>
>     </check>
> </xsp:page>
> 
> --
> Derek Harmel
>  :: Web Programmer
>  :: KCI Technologies
> 
Hi Derek.
In just a few applications (yet) I have used Cocoon, and those times I
have by some reason ( probably the first way it worked ) used the
following syntax when getting request information:

String param = <xsp-request:get-parameter name="param1"/>;
String attrib = <xsp-request:get-attribute name="attrib1"/>;

This is probably just one way of doing things,  and I'm not even sure
that it's your problem, but you could try .This one I know works. More 
info about xsp-request logicsheet :

http://cocoon.apache.org/2.1/userdocs/logicsheets/request.html

Hope this helps.
/Ralph




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message