cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <>
Subject Re: NullPointerException with query parameters
Date Fri, 01 Dec 2000 18:15:28 GMT
James Scott <>  wrote:

>I didn't see this one in the FAQ or in my personal mail archive. Sorry if 
>it's a
>I quite often set the value of XML tags from query parameters, or perform
>actions based on a query param's value. I'm sure this is common practice:
>   String action = request.getParameter("action");
>   if (action.equals("option1"))
>     {
>       //do action
>     }
>   else if (action.equals("option2"))
>     {
>       //do something else
>     }
>     ...
>However, Cocoon (v 1.8, BTW) doesn't do very well when that query parameter
>isn't set. I invariably get a NullPointerException from the 
>method. Have I unknowingly violated some design rules? Should I use another
>method for communicating control parameters?

That's very common but it's not a Cocoon issue, it's a problem with your 
Java code, so it's offtopic for this list. You can't invoke a method (in 
this case equals) on a null, but request.getParameter returns null for 
parameters which weren't set.

Get more from the Web.  FREE MSN Explorer download :

View raw message