I want to invoke a getter method (returns String value) of a Java class from JSP by using “jsp:usebean”, but it returns a null value. What I don’t understand is why it can’t return the updated value.
-
Can someone shed some light on this?
-
Should I use a
Cookieto get the value from JSP?
I’m not sure what you’re using (Struts, plain Servlets, etc.) but essentially you need to add an attribute to the ServletRequest like:
and in your JSP:
or if you use JSTL: