• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

include file path

 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain why I'm getting this error from Tomcat when trying to run a JSP:
org.apache.jasper.JasperException: /countingBeans.jsp(26,0) File "../WEB-INF/jspf/jsptest01/date.jsp" not found
Under a Windows folder SCWCD I have this structure:
/jsptest01/countingBeans.jsp
/WEB-INF/jspf/jsptest01/date.jsp
The offending line of code in countingBeans.jsp is this:
<%@ include file="../WEB-INF/jspf/jsptest01/date.jsp" %>
I will swear that date.jsp does exist in the correct folder.
So, why is it not being found?
 
Enthuware Software Support
Posts: 4892
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the dir structure of your <webapp>?
As a rule, you should not keep your jsp files (in fact, any files that you want the user to access) anywhere under <webapps>/WEB-INF directory.
So, the first thing is, you need to fix the directory structure of your webapp. After that, in your jsp file, you can include another jsp file using:
<%@ include file="date.jsp" %>
This is assumming that the including jsp file and the included jsp file (date.jsp) are in the same directory. Usually, jsp files are kept under <webapp>/jsp directory.
If this all sounds confusing to you then you need to read about the directory structure of a webapp from any book (or even the specs explain it very good). This is very important for the exam.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorted it! I had this in my server.xml:
<Context path="/scwcdjsptest01" docBase="C:\projects\SCWCD\jsptest01" debug="1" reloadable="true" />
Now it works with this, ie with jsptest01 removed.
<Context path="/scwcdjsptest01" docBase="C:\projects\SCWCD" debug="1" reloadable="true" />
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As a rule, you should not keep your jsp files (in fact, any files that you want the user to access) anywhere under <webapps>/WEB-INF directory.


I've been reading this article http://developer.java.sun.com/developer/technicalArticles/javaserverpages/code_convention/ which says that JSP fragments (with .jspf suffix) should be placed in <context root>/WEB-INF/jspf/<subsystem path>/ .
 
mooooooo ..... tiny ad ....
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic