I have looked around this site but have not found anything to help me.

I have a jsp page which takes user input, the page is then posted to a servlet using ajax, the servlet then sets a bean value.

My problem is that when i go back to the main page, the bean value is not displaying in the jsp page.
I created a Bean class which has my setter and getter methods, and a servlet which sets the bean value.

in the servlet i used the following to set the value of the bean

SubscriberBean subscriberBeanRef = new SubscriberBean();
subscriberNameVar = request.getParameter("subscriberName");

In my jsp i use the jsp usebean tag which imports my bean class to get the value, and i set the scope to session. Is that correct?

I have read that i should set the httpsession to set the attribute, i have tried that as well, but still no results in my jsp page.
code used for setting the session attribute.

String subscriberNameVar;
HttpSession session = request.getSession(true);
subscriberNameVar = request.getParameter("subscriberName");
session.setAttribute("subscriberName", subscriberNameVar);

I have no clue what i m doing wrong please help


8 Years
Discussion Span
Last Post by Thirusha

I have solved the problem, but ran into another one.

If a servlet gets rendered the same way a jsp does, if i place the jsp usebean tags in the servlet, shouldnt the bean display in the servlet?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.