配置JSP环境Web.xml详细配置

来源:互联网 发布:dota2 mac能玩吗 编辑:程序博客网 时间:2024/04/29 04:45

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES or CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<!--为Servlet命名 -->
<servlet>
<servlet-name>ServletName</servlet-name>
<servlet-class>com.eays.servlet</servlet-class>
</servlet>

<!--设置会话过期时间 -->
<session-config>
<session-timeout>180</session-timeout>
</session-config>

<!--允许或者禁止EL语言-->
<jsp-property-group>
<url-pattern>*</url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>

<!--允许或者禁止脚本段-->
<jsp-property-group>
<url-pattern>*</url-pattern>
<scripting-invalid>false</scripting-invalid>
</jsp-property-group>

<!-- 申明JSP的编码-->
<jsp-property-group>
<url-pattern>*</url-pattern>
<page-encoding>GBK</page-encoding>
</jsp-property-group>

<!--指定文件内容是否是JSP格式-->
<jsp-property-group>
<url-pattern>*.svg</url-pattern>
<is-xml>true</is-xml>
</jsp-property-group>

<!--定义initParameter参数 -->
<init-param>
<param-name>Param</param-name>
<param-value>Value</param-value>
</init-param>

<!--定义运用范围内的初始化参数 -->
<context-param>
<param-name>Support</param-name>
<param-value>xihaikun@eays.net</param-value>
</context-param>

<!--定制Servlet URL -->
<servlet-mapping>
<servlet-name>ServletName</servlet-name>
<url-pattern>/Servlet</url-pattern>
</servlet-mapping>


<!--指定索引页面 -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<!--指定错误的页面 -->
<error-page>
<error-code>404</error-code>
<location>/NotFound.jsp</location>
</error-page>

<error-page>
<exception-type>exception.ServletNotFound</exception-type>
<location>/sorry.jsp</location>
</error-page>
</web-app>


原创粉丝点击