I have a bunch of checkboxes in my JSP and I am just trying to get their values in my servlet.
Here is the JSP code snippet (extra HTML has been removed)....
Here is the code in the servelt...
String fileIds = request.getParameterValues("deleteFlag");
For some reason fileIds is null.
Any help would be much appreciated.
The below code is working fine..
If you still can't find what is the problem in you code, copy-paste your code so that others can point out the problems..
Mr.David Shapiro wrote:I have the same thing happening. My case is a little more complicated. I am using innterHTML to create a table that has in the first column (i.e., <td>) an input of checkbox type. I click on submit and the table is generated along with the colum with the checkbox with id="reset". I can put in the input something like: <input type="checkbox" id="reset" onclick="resetvalue(this.value) value="something"> and if I click on the checkbox, it does go to the function I made and show the value that I put in an alert for test purposes. However, String reset = getParameterValues("reset") is null if I click on submit again. Any help wuold be appreciated.
Try changing id="reset" to name="reset".
Mr.David Shapiro wrote:Thanks, I changed id to name. I think the magic fix was that I moved the code that generates the <div>targetDiv</div> that receives the table inside the <form> . This caused some issue because the form had some css style to it that got applied t the code in the targetDiv that I did not want, but I worked those out. It looks like I am back in business!
I think the magic fix was changing 'id' to 'name'. In any case, congrats on solving your problem!