Default.xml file in default directory (for berth or tomcat)?

I have a directory named. / Welcome / and. / Welcome / that has a file. /index.jsp.

I know how to say a pier or tomcat, how to start with. /wecome/index.jsp. But I also have many other directories with. /index.jsp, e.g. ---./blogs/,./whatever/, etc.

Without using servlets, there is a way to tell the pier or tomcat: "Hey, when you get the directory request, see if there is ./index.jsp - and show it to the user."

As if I am accessing. / Blogs / I do not want 404 not to be found. I want to see the contents. /blogs/index.jsp, but I do not want my users to be redirected to. /blogs/index.jsp. I want their browsers to display only. / blogs /

I know apache has a function. Any help would be appreciated, thanks.

+8
tomcat jetty
source share
2 answers

"hey, whenever you get a directory request, see if there is ./index.jsp - and display it to the user.

What welcome-file-list should do.

Just add the following to web.xml. In this case, the container will try index.html , and if it does not exist, then it will try index.jsp .

 <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> 

I tested this on Tomcat 5.5 and it works correctly.

Unfortunately, it is very difficult to find the official link for web.xml. So here is the documentation for Oracle weblogic; I think you can trust him ...

+11
source share

see above:

first the container will try index.html, and if it does not exist, then it will try index.jsp.

My application always uses index.html when there is index.jsp, index.html, regardless of the configuration configuration.

0
source share

All Articles