Hi,
Use getParameterValue() instead of getParameter().
Manu.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# MANU TAYAL | WIPRO INFOTECH #
# | 30,Mission Road, 1st Main, #
# Software Engineer | S.R.Nagar, #
# | Bangalore-560027,India. #
# Technology Solutions | #
# | TEL: 080-2241730/2275590 #
# WIPRO INFOTECH. | EXT: 3322,3321,3323 #
# | E-Mail: [EMAIL PROTECTED] #
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Thu, 6 May 1999, Miriam wrote:
> I am trying to determine if a page was called with a parameter or not,
> and display output based on this, however, java is complaining about a
> NullPointerException,
>
> here is what I am trying to do:
>
> // Did we get called with a machine name?
> boolean machine=true;
> if (req.getParameter("hname")==null)
> machine=false;
>
> if (machine) {
>
> // blah blah big table
> }
> else {
>
> // blah blah a different table
>
> }
>
> when I use getParameter the url ~/update.jhtml?hname=something works
> but ~/update.jhtml does not.
>
> Conversely, when I use getParameterValues the url ~/update.jhtml
> works, but ~/update.jhtml?hname=something does not..
>
> the error looks like:
>
>
> !-- java.lang.NullPointerException
> at org.apache.jservssi.ServletInfoRequest.getParameter(Compiled Code)
> at MachineUpdateServ.service(Compiled Code)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at org.apache.jservssi.ServletInfoRequest.runServlet(Compiled Code)
> at org.apache.jservssi.JServSSI.interpretPage(Compiled Code)
> at org.apache.jservssi.JServSSI.doGet(Compiled Code)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at org.apache.jserv.JServConnection.run(Compiled Code)
> at java.lang.Thread.run(Compiled Code)
> -->
>
> -Miriam
>
> ___________________________________________________________________________
> 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
>
___________________________________________________________________________
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