Question about using JSP's with Servlets
I'm trying to create a bean in my servlet, store it in a request variable,
then have a JSP page access it by using request.getAttribute. However, it
doesn't seem to work. Can anyone tell me why. I just want to pass a bean
from a servlet to a JSP.
Here's the bulk of the code...
In the servlet I'm stating -
GreetingBean msg = new GreetingBean();
Then in the JSP page -
GreetingBean msg = (GreetingBean)request.getAttribute("message");
Problem is msg.getMsg() is ALWAYS returning NULL. WHy would this be happening?
I've also tried in the JSP page:
<jsp:useBean scope="request" id="greeting" class="GreetingBean">
This also returns NULL, i.e. resets the value I put in the bean on the previous
page (servlet) which then forwards to the JSP page.
Any ideas or tips?
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center