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

Reply via email to