Having a little trouble with Servlets & Benas, wondering if you could help.
I have a simple servlet that lets a users enter some data, the servlet then access' a database and retrieves appropriate data based on what the user entered (basically you put in a code servlet retrieves product info), then the servlet redirects to a JSP which calls the bean and displays the data (still with me?)...
Now I want to put this info into a bean so that it can be retrieved at any time, but I can't for the life of me remember how you create an instance of the bean and populate it from a servlet. I have looked all over and can't find any examples (decent ones anyway).
"Kenneth", you used to have a valid display name, now you do not. Please change it back immediately since accounts with invalid display names get deleted.
We require display names to be two words: your first name, a space, then your last name. Fictitious names are not allowed.
Kevin P Smith
Joined: Feb 18, 2005
Having a mare with this JavaBean stuff. The servlet is now storing data in the bean and using System.out I can see that the setField(String s) has a value, but when I redirect to the JSP the getField returns 'null', it's like the bean is loosing the values somewhere.
Joined: Sep 22, 2003
Just my thoughts, if you are doing a redirect then the control is passed back to the browser which reissues a new request.
Are you storing the bean in the request? If so redirect will mean you get a new request at the jsp and the bean will be created empty.