This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi guys just started learning jsp and am having issues with setting the values of my bean in a jsp page.
So basically it seems like the setter method of the Bean is never called when the form is submitted because whenever I try to retrieve that firstName value it's always null irrespective of what I enter in the input field.
You're submitting a form to a servlet and then trying to get the submitted values from a bean in the session? No, that's not correct.
The fields from the form will be directly submitted to the servlet where you should retrieve them with request.getParameter() calls.
The useBean and setProperty stuff is kind of a holdover from 10 years ago before modern patterns for web applications arose. They're intended for use when submitting forms to JSPs rather than servlets, which modern practices no longer allow.
If you are new to JSP, I'd recommend reading this article to understand what JSP is all about, and this article to understand how modern web applications should be structured.