Solved

Struts - question on checkboxes - passing values

Posted on 2006-07-24
1
294 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 125 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.

738 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