Most of the form fields are being extracted on the back end in a bean, but now I need to add a checkbox to see which bean to use, so I'm trying to do it in the JSP right after the code above:
<td>Check this box to save them: <input type='checkbox' name='saveaddresses' value='yes'></td>
The println statement above says that saveAddrString is null even when I check the box! How could this be?
Update: Ok, so I just don't understand something about getting info out of those form fields, because all of the other fields are null as well. Back in the bean code, it gets all that by parsing through request.getInputStream(), so I'm wondering if my code above is attempting to call request.getParameter at a point where that parameter is already reset. That of course would make me wonder why getMethod still returns POST, but no matter...I can swallow that they would follow different rules. So, if getParameter won't work at that point in my code, then is there anything else I can do (client-side Javascript?) to make sure I can check for that field's value in the JSP code before I choose which bean to pass everything to?
Coool....it works for me... just make sure if the method is POST ...because once i was setting method as post but was getting in JSP as get...sounds wierd but that is/
but from the above lines it looks to me that the method is indeed POST since the out.println() line seems to be inside the if statement and it seems to be executing since he/she gets an output. But the output is null. I am a little confuced too about this problem.
hi, try casting return value to string..Sometimes it returns null if you do not cast to string.<br> Try <b>(String)request.getParameter("saveaddresses");</b> when getting the value.It should work
If a method returns a String it can return a String or null. I really don't understand what did you are trying to achieve by casting it to a String again? There should be some reason behind it. If there is no logical reason what kind of reason is it?
Can you provide with code segments for cases where it only worked with casting to Strings?
I guess becuase something works without knowing why it works applying it will cause more problems in the future.