| Author |
include file path
|
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
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?
|
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
|
 |
Paul Anilprem
Enthuware Software Support
Ranch Hand
Joined: Sep 23, 2000
Posts: 2912
|
|
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.
|
Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
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
Joined: Sep 29, 2002
Posts: 1683
|
|
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>/ .
|
 |
 |
|
|
subject: include file path
|
|
|