aspose file tools*
The moose likes JSP and the fly likes Adding prelude-include seems to break default welcome file list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Adding prelude-include seems to break default welcome file list" Watch "Adding prelude-include seems to break default welcome file list" New topic
Author

Adding prelude-include seems to break default welcome file list

Lex Lawrence
Greenhorn

Joined: Sep 03, 2008
Posts: 1
I want to use include-prelude to include a file at the beginning of each page in a particular folder of a webapp (/mywebapp/admin). When I specify an include-prelude for all jsp files with the url-pattern *.jsp, it functions as expected. But when I specify a second include-prelude, restricting the path with the url-pattern /admin/*, I am no longer able to browse to the directory without specifying a filename like index.jsp.

From my web.xml:


If I browse to localhost:8080/mywebapp/admin (without trailing path separator), I get a server exception:
org.apache.jasper.JasperException: File "/admin" not found


If I add a trailing path separator, I get a 404 error:
The requested resource (/PIMS-Zambia/admin/) is not available.


I thought maybe it had something to do with welcome files (wild ass guess, reaching beyond my understanding of the situation). I added an explicit welcome-file-list to web.xml:


With the welcome-file-list, now I can browse to localhost:8080/mywebapp/admin/ and it displays index.jsp successfully, but if I remove the trailing slash I get the server exception again.

I'm on Tomcat 6.0.16, JVM 1.5.0_15-b04
Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
I was having the same trouble - it seems like the key is that your welcome page needs to be able to reference the prelude file from the same relative path as all other JSP files.

I have an index.jsp which redirects to file /WEB-INF/jsp/welcome.jsp

All other jsps are in the same folder (/WEB-INF/jsp/) including the prelude and coda files.

Here's my web.xml:


Any JSP needs to be able to see prelude.jsp in precisely that manner.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding prelude-include seems to break default welcome file list