This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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" />
Joined: Sep 29, 2002
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.