This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP relative link/path problem

 
Girish Wakure
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I have a problem in relative path.
we have developed a Web Application using Struts2, editor - Eclipse and web server - jetty-6.1.3.
Project works fine in eclipse with jetty .
now I am deploying it to the Tomcat 7 web server.

Problem comes when I access the relative links.
for example -
when I run in eclipse - jetty, I get application url as http://localhost:8080/base/mainMenu.html and so on..

when run from Tomcat deployment I get url as http://localhost:8080/myApplication/base/mainMenu.html as deployed as war file.
when I click on any link (eg /base/action_name) instead of going to http://localhost:8080/myApplication/base/action_name
it gives http://localhost:8080/base/action_name which results in page not found error.

if I try to remove / from relative path (eg base/action_name) it gives http://localhost:8080/myApplication/base/base/action_name



Please help me out..
 
Girish Wakure
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a solution which works on both.
Because I am continuing development in same environment (Eclipse - jetty) but need to deploy application in tomcat.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to include the context path in resource URLs. See the JSP FAQ for more information, but the EL expression ${pageContext.request.contextPath} will resolve to the context path for the application.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic