Solved

Struts - question on checkboxes - passing values

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This is about my first experience with programming Arduino.
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 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