aspose file tools*
The moose likes JSP and the fly likes Encoding errorPage url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Encoding errorPage url" Watch "Encoding errorPage url" New topic
Author

Encoding errorPage url

Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

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.


Mike Firkser
Rutgers '84
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
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 ]

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

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

Joined: Nov 07, 2003
Posts: 4982
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

Joined: Oct 21, 2003
Posts: 247

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"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encoding errorPage url