Solved

Struts - question on checkboxes - passing values

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
userCompare  challenge 3 61
Fibonacci challenge 11 84
advertisement module in core php 4 89
Device same like our heart 12 47
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now