1. your input for 'ID' has no value

and

2. you don't have anything with the name 'Submit' either....


I think what you want is this...
<form action="/GetUserIdentity/servlet/GetUserIdentity" method="POST">
  <Input type="Text" name="ID" align="left" size=15 value="put something
here">
  <input type="Submit" name="submitbutton"     value="      OK      " >
  <input type="Submit" name="submitbutton" value="    Cancel    ">

 public class GetUserIdentity extends HttpServlet
 {
   ......
  public void doPost(HttpServletRequest
                               request,HttpServletResponse response)
      throws ServletException,IOException
  {
    String username=request.getParameter("ID");
    String action=request.getParameter("submitbutton");
    ...
    System.out.println("You pressed "+action+" button");
   ...
 }


JM

> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology. [mailto:[EMAIL PROTECTED]]On
> Behalf Of Edward
> Sent: Friday, May 17, 2002 1:13 AM
> To: [EMAIL PROTECTED]
> Subject: Who to get button?
> Importance: High
>
>
> Hello,
>  I make a HTML document,it has two buttons,it likes:
>     ......
>      <form action="/GetUserIdentity/servlet/GetUserIdentity"
> method="POST">
>       <Input ID input type="Text" name="ID" align="left" size=15>
>       <input type="Submit" name="okbutton"     value="      OK      " >
>       <input type="Submit" name="cancelbutton" value="    Cancel    ">
>     ......
>
> My servlet is follows:
> public class GetUserIdentity extends HttpServlet
> {
>   ......
>  public void doPost(HttpServletRequest
> request,HttpServletResponse response)
>      throws ServletException,IOException
>  {
>    String username=request.getParameter("ID");
>    String action=request.getParameter("Submit");
>    ...
>    System.out.println("You pressed "+action+" button");
>   ...
> }
>
> When I run it,and I press OK button,but I got:
>   You pressed null button
>
> Why?
> I don't know how to get button,because I want to do follows:
> 1)If OK button is pressed,I process something
> 2)If Cancel button is pressed,I close IE
>
> I have another two questions:
> 1)How to close IE?
> 2)I want to show Input ID with red color,How to modify the statement?
>    <Input ID input type="Text" name="ID" align="left" size=15>
>
> Any idea will be appreciated!
> Thanks in advances!!!
> Edward
>
> __________________________________________________________________
> _________
> 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