I have the following simple program:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
private String instance = "toto";
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.println("<HTML><HEAD><META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no
cache\">");
out.println("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no cache\"><TITLE>HTML
directory");
out.println("</TITLE></HEAD><BODY TEXT=\"#800000\"
BGCOLOR=\"#FEFBEB\"><FORM METHOD=\"POST\" ACTION=\"/servlet/TestServlet\"
name=\"Toto\">");
out.println("<BR><INPUT maxlength='30' type='text' name='FirstName'
id='FirstName' size='30'>");
//out.println("<BR><INPUT maxlength='30' type='text' name='GGG'
id='FirstNameG' size='30'>");
out.println("<BR><INPUT TYPE=\"SUBMIT\" VALUE=\"Test1\" NAME=\"Test\">");
out.println("</FORM></BODY></HTML>");
out.close();
}
public void doPost(final HttpServletRequest req,
HttpServletResponse resp)
throws ServletException, IOException
{
System.out.println ( "Test value: " + req.getParameter( "Test" ) );
String abs = HttpUtils.getRequestURL(req).toString();
resp.sendRedirect( abs );
}
}
I'm getting strange behavior from the submit button and I'm hoping for a
workaround.
If I have one text field and one button and click on the button I get the
submit value (in the above program it will display "Test value: Test1").
This is fine. If the mouse cursor is in the text field and I hit return I
don't get the submit value ("Test value: null"); not good. However, if there
are two text fields and I hit return then the value is submitted ("Test
value: Test1"). Why doesn't it do this with one text field?
(I have tested under serlvetrunner 2.0 and Jserv 1.0 and Apache 1.3.9 under
NT. using IE 4.01 and Netscape 4.62)
dino
___________________________________________________________________________
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