If method
attribute is not set in request the evaluated ${method}
expression will be null in jsp. If you need some value then you have to set it to that value.
In your servlert do post method;
public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
{
String formParameter = req.getParameter("someParameterName");
//Your logic dependen on form parameter
FormObject fo = new FormObject();
fo.setMethod("new value");
req.setAttribute("formObject", fo);
req.getRequestDispatcher("/WEB-INF/yourJspPage.jsp").forward(req, res);
}
You java object:
public class FormObject{
String method;
public String getMethod(){
return method;
}
public void setMethod(String method){
return this.method = method;
}
}
in your yourJspPage.jsp:
<div>${fo.method}</div>
P.S. I haven't tried this example but the idea should be clear. you can search for jsp + servlet tutorial to understand what you are doing. There is similar what you want : enter link description here
session
is similar to request just attributes added to this object last longer (different scope). But I think you should read more documentation and tutorials before asking help for every step.