| Author |
JSP relative link/path problem
|
Girish Wakure
Greenhorn
Joined: Apr 14, 2010
Posts: 28
|
|
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
Joined: Apr 14, 2010
Posts: 28
|
|
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
Joined: Jan 10, 2002
Posts: 56529
|
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: JSP relative link/path problem
|
|
|