You do not always have a decision tree involving defaults, you may want
anything else.
The point is that you may consider getParameter a "convenience method".
A general (but small) problem with many Java packages is that they lack
convenience classes/methods that let you do in a simple and fast way
what you'll want to do in 90% of the cases, keeping the rest of the API
for circumstances where you need more "API granularity".
OTOH it is generally bad to use exceptions as substitute for conditional
blocks, IMO.
Carlos
Christopher Goldman wrote:
>
> My two cents...
>
> I don't have a problem with getParameterValues(), even when I know that I
> only have a single value. I set the default value for my variable when I
> declare it:
>
> String postParam = "[EMAIL PROTECTED]";
>
> Then I just wrap my call in a try-catch block:
>
> try
> {
> postParam = request.getParameterValues( "postParam" )[0];
> }
> catch( NullPointerException npe ) {}
>
> I think it's a matter of style; I prefer not to set my default values inside
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html