Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Need help in getting check box values

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am dynamically adding check boxes by iterating the certain values from the database.
My problem is that when i trying to get the values of check boxes i am not getting when submitting the form.



Please help.

Thanks
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the exact problem you are facing?
Did you do it this way?
1. have different names for the check box (in the iteration you can append the id to the name )
2. retrieve the values in the action class from the request parameter (only checked box names will be there)



 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pankaj semwal wrote:Hi,

I am dynamically adding check boxes by iterating the certain values from the database.
My problem is that when i trying to get the values of check boxes i am not getting when submitting the form.



Please help.

Thanks



Hey Pankaj,

Have you tried request.getParameterValues("candidate_id1");
The above function returns an array which gives mulitple checkbox options seleted...
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks
 
Aparna Raghavan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pankaj semwal wrote:Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks




request.getParameter("name") should give you the value.... how did you try to get the value... As a first step, you can run your application on debug mode and check whether you are getting the values in the request parameter map.
i have not explored much about getting the values using request.getParameterValues("candidate_id1");
you can try that too....
 
meehul Chopra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pankaj semwal wrote:Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks



Hi Pankaj,
Do all of your dynamically generated checkboxes have the same name and different values....if yes then at the server side code
you can very well use request.getParameterValues(//Name of the checkbox group//)
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How can i get the values like request.getParameterValues("candidate_id1"); as need values in

Action class method. i.e in save method

this my jsp page and action class

my jsp page


myaction class
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic