On Wed, 4 Apr 2001, Dominic O'Reirdan wrote:
> I just did this.
>
> if(req.getParameter("paramName").length() != 0) {
>
> do your code
>
> } else {
> throw an exception or something
> }
Well, this isn't really safe either, because you should check whether
it is null first. getParameter() can return null. It will do so when
the parameter does not exist (which is different than it being empty,
which is what you're checking for above).
Now if you're always using parameter names that you know will exist --
i.e. you know they exist in the form, even if you don't know that they
will get set to anything -- then you won't run into any instances of
getParameter() returning null. But that's not really safe programming
style.
> At 19:21 04/04/01 +0530, you wrote:
> >The message of the story:
> >In Java String class behaves like a primitive data type..
> >
> >hope it helps..
> >
> >thanks
> >donny.
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
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