• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with redirect in Servlet Filter

 
Alex Florentino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have a Servlet Filter and when my user click a link by example:

http://mysite/hotel/reviews

my servlet filter should redirect(getRequestDispatcher()) for hotelinfo.jsp, however my images,javascripts and links are broken because him point for

http://mysite/hotel/reviews/onelink when that correct is http://mysite/hotel/onelink.

I change my links for absolute address, but there are a lot of pages...

there is best solutions for it ?

similar issue: http://forum.java.sun.com/thread.jspa?threadID=530382&messageID=2553070

thanks.

Sorry my english
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a web app, the URLs used for images, scripts and other resources should always be expressed as server-relative URLs that begin within the context path. For example, an image:

<img src="${pageContext.request.contextPath}/images/some.image.gif"/>

(assumes JSP 2)

Anything else is asking for the type of troubles you are experiencing.
[ May 18, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!