• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP file Include path fails with tomcat 6.0

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I just switch from a Websphere server to a Tomcat server. Now all my file include paths are broken. Tomcat can not find the specified paths. What's the problem?

Here's my JSP code:

<%@ include file="../common/Header.jsp" %>

This is the error Tomcat is throwing:

org.apache.jasper.JasperException: /web/search/home.jsp(5,0) File "/web/search/../common/Header.jsp" not found


Tomcat should have found the file in:

"/web/common/Header.jsp"
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post the exact location of the include file and the file that uses it.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is ill-advised to use page-relative paths. I'd change them to context-relative paths.
 
Nina Anderson
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to include a file in my JSP as well as images on the page and Tomcat is still not recognizing the file paths.

The following is my project hierarchy:



In my home.jsp, I changed the included statement from

<%@ include file="../common/Header.jsp" %>

to

<jsp:include page="/common/Header.jsp" %>


I've never used Tomcat before, so can some pls tell me What I'm I doing wrong??
[ December 10, 2007: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nina Anderson:
I'm trying to include a file in my JSP as well as images on the page and Tomcat is still not recognizing the file paths.

You need to specify them correctly.

The following is my project hierarchy:

This was not very helpful because you did not enclose the list in CODE tags to preserve the indentation. I added them on your behalf. Please be sure to use CODE tags in the future.

-> WEBINF



WEBINF or WEB-INF? If the latter, please take more care when posting. Please read this for more information.

<jsp:include page="/common/Header.jsp" %>



common or Common? Case counts! Pick one and use it consistently. Most experienced developers will always use all lowercase.

Your common folder is under WEB-INF. Don't you think you;d need to include that as part of your path?
[ December 10, 2007: Message edited by: Bear Bibeault ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic