Greetings,

Please take a look at the following "skeleton code":

  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    doPost(request, response);

  } // end doGet

  public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {


    String requestedPage = request.getParameter("id");

    if (requestedPage.equalsIgnoreCase("welcome")) {

      ( puts up a HTML form with two text fields and two buttons (SUBMIT / RESET)
        with the form action set to Servlet?id=login )
    }

    if (requestedPage.equalsIgnoreCase("login")) {

      ( Performs some login authentication stuff and presents the result to the user )
    }

  } // end doGet


Okay, so what's my problem then? Well, when I type
http://localhost:8080/Servlet?id=welcome
or
http://localhost:8080/Servlet?id=login
it works like a charm.

However, if I press the SUBMIT button, the form loads
"Servlet?id=login" for sure, but then I get a 500 error
from the server with a "reported exception:
java.lang.NullPointerException."

What's the difference between loading the page
"manually" from the browser compared to the same page
being loaded from a form action? I suppose that one
difference is of course that in the latter case, the
parameters from the form gets sent along with the
request, but what's the cause of the exception?

Any hints appreciated... Thanks!

/Jon

___________________________________________________________________________
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

Reply via email to