I have a result jsp page, which print the string variable of java class.
Can someone give me any idea.
I am using simple httpServlet as action class.
Class A
{
String name;
public void setName()
{
this.name = callMethod(); // somehow it assigns the value. Nothing to do with problem
}
}
Result.jsp
Here i need to print the current value of String
解决方案
I assume that the servlet, at the end, forwards the request to the JSP.
You should store the objects you want to use in the JSP in the request, as an attribute.
In the action class / servlet :
request.setAttribute("name", name);
In the JSP (using the JSTL) :
or