Andrew ,

You are using a get in your html form  (METHOD=GET) but you are using a doPost() 
method in your servlet. Either change the method (METHOD = POST) or change the
servlet method to doGet() or service();


GL

Andrew Ahnn wrote:

> I am having some problems with servlets.
> I have a Login.html which hits the LoginServlet. Within the doPost method I am 
>trying to extract the parameters from the httpResult, but they are all null.
>
> The Login.html is
> <HTML>
> <HEAD>
> <TITLE>Login Test</TITLE>
> <BODY>
> <H3><CENTER>Login</CENTER></H3>
> <FORM NAME = "Test" ENCTYPE="text/plain" ACTION = "http://simon_peter:7001/login" 
>METHOD="GET">
> <PRE>
>
> UserName: <INPUT TYPE = TEXT name = "Username"><P>
> Password: <INPUT TYPE = PASSWORD name = "Password"><BR><BR>
> </PRE>
> <BR>
> <INPUT TYPE = SUBMIT VALUE = "Done with Login">
> <BR>
> </FORM>
> </BODY>
> </HTML>
>
> And the LoginServlet.
> public void doPost (HttpServletRequest httpRequest, HttpServletResponse httpResponse)
>         throws ServletException, IOException
>   {
>   HttpSession session = httpRequest.getSession(true);
>
>   String stUserName = httpRequest.getParameter("Username");
>   String stPassword = httpRequest.getParameter("Password");
>   Login login = null;
>
>   httpResponse.setContentType("text/html");
>   PrintWriter out = httpResponse.getWriter();
>   out.println("DoingPost:\r\n");
>   out.println("Username was :" +stUserName +"\r\n");
>   out.println("Password was :" +stPassword +"\r\n");
> blah blah blah....
> out.close();
> ---------------------------------------
> the result is spitting out.
> DoingPost: UserName was : nullPassword was :null
>
> Can anyone shead some light. thanks
>
> ___________________________________________________________________________
> 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

Reply via email to