• Post Reply Bookmark Topic Watch Topic
  • New Topic

redirecting to an error page - relative paths on the error page no longer work.  RSS feed

 
Sarah
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a single error page with relative paths to images. Each page of my web application uses the jsp errorPage attribute to redirect there if there is an exception. The problem is: if the exception occurs on a page in a different directory level than the error page, the relative paths on the error page no longer work. Do you always need to use absolute paths for images on a page you are redirecting to? How else could I solve this?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tend to always use absolute paths to images etc. Even if you you consider this a problem I see it as preferable since you only have to maintain a single error page.
Dave
 
Shawn Bayern
Author
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using absolute paths, you could include a <base> tag in your page's <head>. E.g.,
<head>
<base href="/errorPage.jsp" />
</head>
The <base> tag informs the browser what path it should use as the base for relative-URL resolution.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!