I was able to make this to work in Struts, but in Struts2 I can not understand what the problem is, I am getting the null as result.
My Action code:
String[] stuff = request.getParameterValues("stuff");
if (stuff != null) {
for (int i = 0; i < stuff.length; i++) {
Integer id = new Integer(stuff[i]);
System.out.println("stuff id: " + id);
Stuff stuffObj = stuffService.find(id);
System.out.println("stuff name: " + stuffObj.getStuffName());
}
}
My JSP code:
<s:form action="add-menus" method="POST" enctype="multipart/form-data" theme="simple">
Stuff <s:checkboxlist name="stuff" list="stuffList.{stuffName}"/>
</s:form>
Also I used the method, with setter and getter, the same thing, I am getting the null result from JSP, is this working with Struts2? P.S. I am trying to get the checkboxes that was selected by the user