Re: Help: jsp:include error???
From: kaeli (tiny_one_at_NOSPAM.comcast.net)
Date: 09/01/04
- Next message: Harry Colquhoun: "Re: Method as parameter of other method in Java?"
- Previous message: Chris Uppal: "Re: File.lastModified *extremely* slow ?"
- In reply to: eeyimaya: "Help: jsp:include error???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 1 Sep 2004 13:14:39 -0500
In article <41e89d23.0409010733.3dec282@posting.google.com>,
eeyimaya@hotmail.com enlightened us with...
> 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
Why are you putting an html file in your WEB-INF directory?
Generally speaking, files meant to be served to a client shouldn't go there.
> WhatsNew.jsp:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Put a URL in that doctype or it throws some browsers into quirks mode. That's
usually not a good thing.
> 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.
Then put it in a password protected directory that is a subdir of your webapp
(webmodule) directory and has normal web permissions. WEB-INF is NOT for
hiding html files.
If you're using Apache, look at .htaccess files. You can even protect a few
files in a given directory, but protecting the whole directory is simpler.
Note that the JSP, once compiled, is often moved by the server to some other
location. How the server handles relative links to resources can be tricky.
Note this line from the error message:
at _jsp._whatsnew__jsp._jspService(/WhatsNew.jsp:18)
See how the file name changed? The location probably did, too.
I'm not familiar with Resin, but try putting the file in a directory, like
C:\resin\webapps\WebModule\myProtectedHTMLfiles
then linking like you are now with the directory name. If it interprets links
relative to the application root, add a leading slash.
(/myProtectedHTMLfiles/myfile.html)
HTH
-- -- ~kaeli~ Why do they lock gas station bathrooms? Are they afraid someone will clean them? http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
- Next message: Harry Colquhoun: "Re: Method as parameter of other method in Java?"
- Previous message: Chris Uppal: "Re: File.lastModified *extremely* slow ?"
- In reply to: eeyimaya: "Help: jsp:include error???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|