E
eeyimaya
Hello,
I am studying with "Core Servlets and Java Server Pages Volume1" on
Servlets and JSP.And I use Resin for
examples in the book. (The problem is at chapter 13.1)
I have one jsp and one html file as below:
C:\resin\webapps\WebModule\WhatsNew.jsp
\WEB-INF\web.xml
\WEB-INF\aaa.html
WhatsNew.jsp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>What's New at JspNews.com</TITLE>
<LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css">
</HEAD><BODY>
<TABLE BORDER=5 ALIGN="CENTER"><TR><TH CLASS="TITLE">What's New at
JspNews.com</TABLE>
<P>
Here is a summary of our three most recent news stories:
<OL><LI><jsp:include page="WEB-INF/aaa.html"/></OL>
</BODY></HTML>
aaa.html:
<B>Bill Gates acts humble.</B> In a startling and unexpected
development, Microsoft big wig Bill Gates put on an open act of
humility yesterday.
<A HREF="http://www.microsoft.com/Never.html">More details...</A>
Here aaa.html is wanted to ben shown in the WhatsNew.jsp.
But when I call the page as http://localhost/WebModule/WhatsNew.jsp.
it gives the error given below. If I put the aaa.html to the WebModule
folder as the WhatsNew.jsp it works. But I wanted aaa.html cannot be
seen by clients.Author also states this as:
"Finally, note that you are permitted to place your pages in the
WEB-INF directory. Although the client is prohibited from directly
accessing files in this directory, it is the server, not the client,
that accesses files referenced by the page attribute of jsp:include.
In fact, placing the included pages in WEB-INF is a recommended
practice; doing so will prevent them from being accidentally accessed
by the client (which would be bad, since they are usually incomplete
HTML documents)."
Error is:
java.io.FileNotFoundException: /WebModule/WEB-INF/aaa.html
at com.caucho.servlets.FileServlet.service(FileServlet.java:245)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:113)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:129)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:476)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:345)
at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:807)
at _jsp._whatsnew__jsp._jspService(/WhatsNew.jsp:18)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.pageservice(Page.java:571)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
at java.lang.Thread.run(Thread.java:534)
What is wrong?
Please help...
Thanks.....
I am studying with "Core Servlets and Java Server Pages Volume1" on
Servlets and JSP.And I use Resin for
examples in the book. (The problem is at chapter 13.1)
I have one jsp and one html file as below:
C:\resin\webapps\WebModule\WhatsNew.jsp
\WEB-INF\web.xml
\WEB-INF\aaa.html
WhatsNew.jsp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>What's New at JspNews.com</TITLE>
<LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css">
</HEAD><BODY>
<TABLE BORDER=5 ALIGN="CENTER"><TR><TH CLASS="TITLE">What's New at
JspNews.com</TABLE>
<P>
Here is a summary of our three most recent news stories:
<OL><LI><jsp:include page="WEB-INF/aaa.html"/></OL>
</BODY></HTML>
aaa.html:
<B>Bill Gates acts humble.</B> In a startling and unexpected
development, Microsoft big wig Bill Gates put on an open act of
humility yesterday.
<A HREF="http://www.microsoft.com/Never.html">More details...</A>
Here aaa.html is wanted to ben shown in the WhatsNew.jsp.
But when I call the page as http://localhost/WebModule/WhatsNew.jsp.
it gives the error given below. If I put the aaa.html to the WebModule
folder as the WhatsNew.jsp it works. But I wanted aaa.html cannot be
seen by clients.Author also states this as:
"Finally, note that you are permitted to place your pages in the
WEB-INF directory. Although the client is prohibited from directly
accessing files in this directory, it is the server, not the client,
that accesses files referenced by the page attribute of jsp:include.
In fact, placing the included pages in WEB-INF is a recommended
practice; doing so will prevent them from being accidentally accessed
by the client (which would be bad, since they are usually incomplete
HTML documents)."
Error is:
java.io.FileNotFoundException: /WebModule/WEB-INF/aaa.html
at com.caucho.servlets.FileServlet.service(FileServlet.java:245)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:113)
at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:129)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:476)
at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:345)
at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:807)
at _jsp._whatsnew__jsp._jspService(/WhatsNew.jsp:18)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.pageservice(Page.java:571)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
at java.lang.Thread.run(Thread.java:534)
What is wrong?
Please help...
Thanks.....