Spring MVC absolute URL problem

Posted by Umar on Stack Overflow See other posts from Stack Overflow or by Umar
Published on 2010-03-26T07:08:29Z Indexed on 2010/03/26 7:13 UTC
Read the original article Hit count: 627

Filed under:
|
|

Background

I am developing an application (with Spring MVC) with its base path as:

http://localhost:8080/myapplication/

I have a stylesheet /css/style.css that I am trying to refer with absolute path in a JSP as:

<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen, projection">

Problem

The stylesheet never loads in the browser. When I follow the stylesheet link through browser's view source feature, the link appears to be:

http://localhost:8080/css/style.css

Which should have had been:

http://localhost:8080/myapplication/css/style.css

I used to fix this issue with html:rewrite tag while working with Struts. Is there any equivalent tag/technique in Spring MVC?

Thanks for your time.

© Stack Overflow or respective owner

Related posts about java

Related posts about spring-mvc