Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TomCat 6: can welcome page be inside WEB-INF?

I'm following this example to get Spring up & running: http://static.springsource.org/docs/Spring-MVC-step-by-step/part2.html

What they do is move all .jsp files inside the WEB-INF, to stop users accessing them directly... so far so good. However the servlet has a welcome page of index.jsp, and when this is moved inside the WEB-INF dir I get errors. I can't determine if Tomcat 6 should allow the welcome page to be inside WEB-INF or not?

like image 551
Mr. Boy Avatar asked Sep 28 '09 20:09

Mr. Boy


People also ask

What file specifies the default welcome page?

The server looks for the welcome file in the following sequence by default: welcome-file-list in web. xml.

Can we use a JSP in a Java Web application as the welcome file?

In a java-based web application, the HTML or JSP program can be configured as a welcome page.

What is welcome file in Servlet?

The welcome files mechanism allows you to specify a list of files that the web container will use for appending to a request for a URL (called a valid partial request) that is not mapped to a web component.


2 Answers

Nothing inside WEB-INF can be directly accessed, but must first pass through something else (usually a servlet), which then forwards the request internally to the WEB-INF resource.

like image 181
skaffman Avatar answered Oct 22 '22 19:10

skaffman


I am trying the same tutorial. The tutorial doesn't say this but I changed the value in my web.xml from "index.jsp" to "/WEB-INF/jsp/index.jsp".

like image 45
Sam Avatar answered Oct 22 '22 19:10

Sam