• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoding errorPage url

 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, does the error page required to be part of the session?
Even without the session id, the error page can still be invoked without any problems.
I have worked with an online data mining system, and assume that the browser does not support cookies and even javascript, but still, we do not need to encode the ERROR pages for exception handling.
We just need to encode the URL for those *normal* pages that involved in the sessions (or the system).
So, does this really have such needs?
Nick.
 
Mike Firkser
Ranch Hand
Posts: 249
Java Oracle PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic