Solved

Servlets & Checkboxes

Posted on 2000-05-10
1
165 Views
Last Modified: 2013-11-24
I have a servlet that creates dynamic html with rows in a table, each row has a check box so the row can be selected.  The user can select any or all of the check boxed rows.

How do I pass and then find out which rows where checked in the next servlet that is called?

Thank you in advance.
0
Comment
Question by:suzuki
1 Comment
 

Accepted Solution

by:
Rich6176 earned 100 total points
ID: 2797420
  When the checkbox is created by the original servlet make sure the name and values are unique for each element. Say for instance the first checkbox of the first row could have it's name set to A1, next A2, A3, etc..... When the form is then submitted only the names and values of the checked checkboxes will be returned then you can sort the name and value of the parameters sent to construct the next .html file.
Try this code if your having trouble with parameters

private void getParams(HttpServletRequest req)
{
      Enumeration enum = req.getParameterNames();
      String value;
      String name;
      
      while (enum.hasMoreElements());
      {
            name = (String)enum.nextElement();
            value = req.getParameter(name);
            System.out.println(name + " = " + value);

            if (name.equals("A1"))
                this.firstCheckboxClicked();
      }
}
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question