web.xml related configuration

Disclaimer: The materials used in this column are written by VIP students of Kaige Academy. Students have the right to remain anonymous and have the right to final interpretation of the article. Kaige Academy aims to promote VIP students to learn from each other based on public notes.

web.xml related configuration

Configure the default page, this forwarding mechanism will prevent you from seeing URL changes:

image

By default, web.xml is configured as a .jsp or .html file with index and default as the filename prefix. So as long as there is a file in your project directory with the same name as the file configured in the above figure, then when you access the web project, you will access this file by default.
For example, I create an index.jsp in the web project directory, and then access the web project on the browser:

image

Browser access:

image

As shown in the figure, you can see that the URL address has not changed, but it has accessed this index.jsp. Usually, when we visit a website domain name, we also visit such a default page, but the URL will not change. , which is what makes this forwarding mechanism special.

Configure the page to jump to after an http error status code occurs:

image

When a 404 error occurs, it jumps to the 404.html file in the root directory.

Configure the expiration time and ID name of the session:

image

ServletContext object initialization parameter configuration:

image

Multiple <context-param> tags can be configured, <param-name> the name of the configuration parameter, <param-value> the value of the configuration parameter, these two tags need to be configured within the <context-param> tag.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326573406&siteId=291194637