I'm using Tomcat 4.0 and jdk1.3.1. I've written a simple servlet that
takes parameter from the HttpServletRequest using getParameter and simply
displays on the console. In the HTML form, I have two check boxes with the
same name, say "options", with different values. When the servlet is being
executed, it's printing only one value in Tomcat, while it's printing both
the values separated by commas ("1,3") in Java Web Server. I want to get
the same functionality as in Java Web Server. How to get it? If can't 'Why?'.


Example code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestCheckbox extends HttpServlet {
 public void doGet(HttpServletRequest req, HttpServletResponse res) throws 
ServletException, IOException {
  String values = req.getParameter("options");
  System.out.println("checkbox value : " + values);
 }
}
 And the HTML form:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<form method="get" action="http://localhost:8080/examples/servlet/TestCheckbox";>
  Check box 1
  <input type="checkbox" name="options" value="1">
  <br>
  Check box 2
  <input type="checkbox" name="options" value="3">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</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