Is there a way to encode the url for the error page, in case a user who has disabled cookies gets sent to an error page. I've tried: <%@ page errorPage=request.encodeURL("error.jsp") %> but that doesn't work, and I've tried: <% String newURL = response.encodeURL("error.jsp"); %> <%@ page errorPage=newURL %> My error page does "work" if I just put in: <%@ page errorPage="error.jsp" %>. Thanks in advance for any help.
The encodeURL() is basically used for the 2 JSP actions (or Servlet redirection): INCLUDE and FORWARD. When you similar transform the String at the runtime, while the directive is done at the translation time, it does not work. And thus, you may need to have a convert function for this purpose, or a redirection during runtime. Nick. [ March 04, 2004: Message edited by: Nicholas Cheung ]
Directives are processed at JSP translation time, so you cannot use dynamic (request time) attributes. Are you sure you need to do this? Most of the time, the error page is invoked as a forward from the point of the error and so it's not invoked in a request of its own.
Thanks for the responses. The reason we use the encodeURL() function is in case users to our Wepp App have cookies disabled. So if a user who has cookies disabled encounters an error, they'll get kicked off the system. Any ideas how to prevent this other than telling our users to enable cookies.
Joined: Nov 07, 2003
The error page doesn't need to be part of the session. However, if the user has cookies disabled on their browser, and they get sent to the error page, will their session end? Will the session info that is tacked onto the URL has be lost. These and other questions will be answered in the next episode of "As the Code Compiles"