zoukankan      html  css  js  c++  java
  • 配置JSP环境Web.xml详细配置

    <?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></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>

  • 相关阅读:
    第十三周课程总结
    第十二周课程总结
    第十一周课程总结
    第十周课程总结
    第九周课程总结&实验报告(七)
    第八周课程总结&实验报告(六)
    第七周课程总结&实验报告(五)
    第六周学习总结&java实验报告四
    2019秋Java学期课程总结
    2019Java第十四周课程总结
  • 原文地址:https://www.cnblogs.com/xinzhuangzi/p/4100602.html
Copyright © 2011-2022 走看看