How to get each checkbox textfield value


<display:table name="books" excludedParams="*" pagesize="25" class="table" export="false"  sort="external" id="book" requestURI="">              
 <display:column title="#">
   <input type="checkbox" name="book" value="${book.Id}"/>
 <display:column title="bookName" style="width: 100%" >
   <c:out value="${}"/>
 <display:column title="bookDiscount" style="width: 100%" >
   <html:text property="discount"styleId="discount"/>                 

String[] percentage = request.getParameterValues("discount");
String[] cardTypeId = request.getParameterValues("book");

If I check a checkbox , I want to get that checked checkbox discount value using java in action class, so i can add the value in database. I have tried but not working. Could someone help me?


You are able to fetch the id of the check box na.Now compare the all id's of book with the check box id and find the position.Now the discount will be percentage[position]


<input id="${book.Id}" type="checkbox" name="book" value="${book.Id}"/>

in javascript

 var id =;
 var position;
 var length = percentage.length();
 for(var i=0;i<length;i++){
   if( id == cardTypeId[i]){
    position = i;
 var percen = percentage[position];

Ideally your checkbox, should be part of a Form. And then in your Action class, you need to fetch the checkbox values using the Form attributes.

Need Your Help

execute shell, msgbox wont display

shell excel-vba batch-file text-files msgbox

I have an excel macro that creates and executes a batch file, which in turn executes a file that converts a pdf to text file. The macro then scans the text file for a keyword, and returns a value f...

.htaccess image redirect

php image apache .htaccess redirect

I've written a PHP class to add a watermark to an image, it works great when accessed via URL directly. I would like to "redirect" every image to my URL like so:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.