Manage Session when broswer has disable cookies

java, jsp, servlets, session

Solution

In the JSP side, you can use JSTL's `<c:url>` for this.

<a href="<c:url value="page.jsp" />">link</a>

Easy as that. It will automagically append the `jsessionid` when cookies are disabled.

In the Servlet side you need `HttpServletResponse#encodeURL()` or -usually the preferred one inside Servlets- `HttpServletResponse#encodeRedirectURL()` for this.

response.sendRedirect(response.encodeRedirectURL("page.jsp"));

Problem

I wants to know that How can i Manage Session if the client browser has disabled cookie feature.. If I wants to implement it in simple JSP - Servlet, then how can I do that ? Thanks in advance...

Original source