troubleshooting Question

save multiple checkbox values

Avatar of cofactor
cofactorFlag for India asked on
JavaJSPJava EE
30 Comments4 Solutions972 ViewsLast Modified:
I want to keep  multiple checkboxes in the JSP page . I want to save and retrieve their values .
Could you please help me to find a  easy and best  solution ? I'm explaining below where I need help.

Question :

Q1: What should be the checkbox names ?


I have existing code ..
while (regioniterator.hasNext()){
  String region = (String); // get the key

 // I want to create 15 checkboxes  for each region . How do I keep the checkbox name ?
 // Here is a proposed design . is this a good design  ?

   for(int j=0;j<15;j++){ % > <input type="checkbox"    name="<%=region><%=j>" value="" align="middle"> <% }%>



 When the form  be submitted to the action class. How do I retrieve them in the action class ?
 I'm stuck here . Because all those many checkboxes are created dynamically .  I can not use request.getParameterName() now in the action class to retrieve from the request .

 What trick to apply here ?


 How do I save so many checkbox values in the DB ? I need to save and retrieve their values  in the JSP also.

 What table and how many column to make here to hold their values  ?
 How the table design will look like ?
Join our community to see this answer!
Unlock 4 Answers and 30 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 30 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros