Guys!
In order to check cookies with EL I code as follows,but I get "The User is:" and nothing else get printed.
Please kind enough to help me to get rid of this.
servlet.
-------
package com.foo;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class CookieTest extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
Cookie cookie = new Cookie("user",name);
response.addCookie(cookie);
RequestDispatcher view = request.getRequestDispatcher("result.jsp");
view.forward(request,response);
}
}
result.jsp
----------
<%@ page isELIgnored="false"%>
<html>
<body>
The User is: ${cookie.user.value}
</body>
</html>