how to do URL-Rewriting when browser cookies are disabled? <p>I am trying to achieve URL-Rewriting for my Application. I am using java,servlet, JSP, tomcat 7 as part of the technologies. </p> <p><strong>BackGround:</strong> The reason for URL-Rewriting is that when my browser cookies are disabled the connection between the client and the server is not established and session on being lost and for each request that comes from the browser the server thinks as a new request. </p> <p>By reading through the <a href="https://stackoverflow.com/questions/2065735/how-can-i-do-sessions-in-java-if-some-one-disables-cookies-in-my-browser?lq=1">interne</a>t found that URL-Rewriting is one solution. </p> <p>My application has just one JSP page called <code>root.jsp</code> This is how i am loading the jsp page from my servlet. I have only one servlet that handles all the request.</p> <pre><code>getServletContext().getRequestDispatcher("/view/root.jsp").forward( request, response); </code></pre> <p>In <code>root.jsp</code> includes another jsp pages as a part of <code>root.jsp</code> it shown below. Based on the programming logic the respective JSP page that needs to be included get added.</p> <pre><code>&lt;div class="grey_container"&gt; &lt;jsp:include page="${requestScope.jspPage.pageFileUrl}" flush="false" /&gt; &lt;/div&gt; </code></pre> <p>I read that the URL-rewriting is possible using <code>HttpServletResponse encodeURL() and encodeRedirectURL()</code>. For the JSP pages this encodeURL is achievied using <a href="http://www.tutorialspoint.com/jsp/jstl_core_url_tag.htm" rel="nofollow"><code>&lt;c:url&gt;</code></a></p> <p>WHat i have tried </p> <p>In my servlet show below, I did not see any Jsession ID being appended to the URL.</p> <pre><code>getServletContext().getRequestDispatcher(response.encodeURL("/view/root.jsp")).forward( request, response); getServletContext().getRequestDispatcher(response.encodeRedirectURL("/view/root.jsp")).forward( request, response); </code></pre> <p>Next thought that i might need to configure something similar in JSP using <code>&lt;c:url&gt;</code> tag. So tried to configure in the <code>&lt;jsp: include&gt;</code> but it is throwing some compilation exception. so at this point of time i tried different approaches to make that JSP compilation error go away but was not successful. So thought that is it possible configure to <code>&lt;jsp: include&gt;</code> to have <code>&lt;c:url&gt;</code> was not sure. configuring in JSP with <code>&lt;c:url&gt;</code> is needed?</p> <p>Below is the exception when i try to configure the </p> <pre><code>&lt;jsp:include page="&lt;c:url value="${requestScope.jspPage.pageFileUrl}"/&gt;" flush="false" /&gt; org.apache.jasper.JasperException: /view/root.jsp (line: 97, column: 38) Unterminated &amp;lt;jsp:include tag at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133) at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:992) at org.apache.jasper.compiler.Parser.parseInclude(Parser.java:854) at org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1116) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1451) at org.apache.jasper.compiler.Parser.parse(Parser.java:138) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) </code></pre> <p>How should i configure my servlet/JSP page for the URL rewriting?</p>