serverlet_serverlet生命周期_serverlet 书(7)

电脑杂谈  发布时间:2017-03-02 13:01:40  来源:网络整理

10、指定欢迎文件页配置

<welcome-file-list>

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

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

<welcome-file>index.htm</welcome-file>

</welcome-file-list>

11、配置错误页面

一、 通过错误码来配置error-page

<error-page>

<error-code>404</error-code>

<location>/NotFound.jsp</location>

</error-page>

上面配置了当系统发生404错误时,跳转到错误处理页面NotFound.jsp。

二、通过异常的类型配置error-page

<error-page>

<exception-type>java.lang.NullException</exception-type>

<location>/error.jsp</location>

</error-page>

上面配置了当系统发生java.lang.NullException(即空指针异常)时,跳转到错误处理页面error.jsp

12、TLD配置

<taglib>

<taglib-uri></taglib-uri>

<taglib-location>/WEB-INF/jsp/debug-taglib.tld</taglib-location>

</taglib>

如果MyEclipse一直在报错,应该把<taglib> 放到 <jsp-config>中

<jsp-config>

<taglib>

<taglib-uri></taglib-uri>

<taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>

</taglib>

</jsp-config>

13、资源管理对象配置

<resource-env-ref>

<resource-env-ref-name>jms/StockQueue</resource-env-ref-name>

</resource-env-ref>

14、资源工厂配置

<resource-ref>

<res-ref-name>mail/Session</res-ref-name>

<res-type>javax.mail.Session</res-type>

<res-auth>Container</res-auth>

</resource-ref>

配置连接池就可在此配置:

<resource-ref>

<description>JNDI JDBC DataSource of shop</description>


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-35381-7.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...