• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Including JSP Fragment at different levels

 
Ranch Hand
Posts: 139
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a web application in Struts 2. It has common main menu and footer.. so I extracted the common stuff into JSP fragments and including them on different pages..

Not the issue is on of the JSP fragment is Main Menu at top bar. The urls i have given relative paths..its working fine with the first level urls.. like mydomain/home, mydomain/firstpage

but for the second level.. mydomain/inside/innerpage in this case the links on included jsp fragment are not working properly as I have given relative paths..


Is there any option or Do I have to go with absolute urls.. Its hard to maintain with absolute urls when I am testing in localhost..
 
Bala Tilak
Ranch Hand
Posts: 139
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

${pageContext.request.contextPath} gives the webApp context. So this solved the issue for both Development environment as well as production. Thank you.

Example:

 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic