Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding prelude-include seems to break default welcome file list

 
Lex Lawrence
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic