Solved

Servlets & Checkboxes

Posted on 2000-05-10
1
163 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JavaScript/Java - Changing an image background color 4 56
servlet doXXX methods 3 38
more than one jdk and one jre 1 34
reverse digits of a number using for loop 5 36
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now