jsp - How to give URL for Home page from Spring MVC on Heroku -


i have looked , tried everywhere without success posting question.

recently deployed working spring mvc app on heroku platform, pleasant experience most. how ever spring url tag or jstl core url tag behaving differently on heroku, on local tomacat server.

for example links '>sign in perfect resolves http: //mydomain:port/context/signin on local after deploying heroku /signin absolute path, removed , working good.

however have home link on nav bar '>home if remove forward slash home link point ever current url on address bar instead of context home.

any suggestions ?

from experience works best me not hardcode link / on left, create "root" variable on jsp:

<c:set var="root" value="${pagecontext.request.contextpath}"/> 

then in jsp whenever need reference root path:

<img src="${root}/resources/mycoolpic.png"/> 

other variation can use html <base..> tag set / refer make code more obscure , hard understand. example:

<base href="my-root"> <img src="/resources/mycoolpic.png"/> 

will resolve /my-root/resources/mycoolpic.png


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -