Note : This question is already answered in the following link , the only difference is that in this question I just want to send a specific value other than a complete object.
I want to create a form in which along with input value i also want to send a value from JSP to servlet with setAttribute() method.
Example
demo1.jsp
<form method="POST" action="DEMO1">
<% request.setAttribute("value",1); %>
<input type="submit" value="Add" />
</form>
DEMO1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
PrintWriter pw=response.getWriter();
pw.println(request.getAttribute("value"));
}
It prints a null value when i used to post my page. Is there any process where I can access the setAttribute() value at jsp in servlet.