?
Solved

Servlets & Checkboxes

Posted on 2000-05-10
1
Medium Priority
?
169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Rich6176 earned 400 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

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

777 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