Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Struts - question on checkboxes - passing values

Posted on 2006-07-24
1
Medium Priority
?
296 Views
Last Modified: 2010-04-16
Hello All,

I have got a doubt in struts.  in my searchresults jsp page, i have a column for a checkbox, along with other columns.  if i click the header column, then all the checkboxes in the column gets selected.  my question is how to get the selected checkboxes and also i have to pass some parameters while getting the selected checkboxes so that i have to use those parameters for generation of a pdf file..
can anybody guide me in this ?

thanks
0
Comment
Question by:altima4u
[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
 
LVL 6

Accepted Solution

by:
Holger101497 earned 250 total points
ID: 17168794
we need some additional information about what you're doing!
How did you create the checkboxes? Which name(s) do they have?
Are you using an ActionForm or something like that?
Just show us a few lines of the JSP page where you create the form and the checkboxes...

In general, the name and value of the checkbox is sent as a parameter IF it is selected.
<input type="checkbox" name="delete" value="12345">
<input type="checkbox" name="delete" value="67890">

You can then call "String[] toDelete = request.getParameterValues("delete");

If both are checked, you get an array with two elements, if only one is checked, you get an array with one element. If none is checked, I'm not sure, I think you get null.
Unfortunately, it is very hard to find out which checkboxes are NOT selected because they don't send any data to the server...

I don't understand your question about additional parameters... You can just add them to the form as hidden fields...
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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 …
Six Sigma Control Plans

721 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