Here I am displaying 24 checkboxes.I want to get all the values of checked checkboxes in action class and insert it as a new record inside database.Inserting will be done on
I just changed my datatype of variable from boolean to string[] . It will store the values of the checkbox selected. Below is my jsp.
Rangabhoomi
Fire NOC
Below is my action class
package com.checkboxInStruts2;
import com.opensymphony.xwork2.ActionSupport;
public class CheckboxAction extends ActionSupport
{
private String checkMe[];
public CheckboxAction() {
// TODO Auto-generated constructor stub
}
public String[] getCheckMe() {
return checkMe;
}
public void setCheckMe(String[] checkMe) {
this.checkMe = checkMe;
}
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
for(int i=0;i
and for display use below tag on jsp.It will display the array of string values of selected checkboxes.