分享
 
 
 

安装jstl中的web.xml配置问题

王朝java/jsp·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

http://apache.towardex.com/jakarta/taglibs/standard/下载了最新的jstl,然后把standard.jar和jstl.jar文件拷贝到\WEB-INF\lib\下,\tld\下的8个tld类型文件拷到"\WEB-INF\"下。

接下来配置web.xml文件,这里我就有些糊涂了。

下面这个是《jsp设计》的web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com//dtd/web-app_2_3.dtd">

<web-app>

<!-- Used by the JSTL I18N actions -->

<context-param>

<param-name>

javax.servlet.jsp.jstl.fmt.fallbackLocale

</param-name>

<param-value>

en

</param-value>

</context-param>

<!-- Used by the JSTL database actions -->

<context-param>

<param-name>

javax.servlet.jsp.jstl.sql.dataSource

</param-name>

<param-value>

jdbc:mysql:///test,org.gjt.mm.mysql.Driver

</param-value>

</context-param>

<!-- Used by the ResourceManagerListener in Chapter 18 -->

<context-param>

<param-name>driverClass</param-name>

<param-value>

org.gjt.mm.mysql.Driver

</param-value>

</context-param>

<context-param>

<param-name>jdbcURL</param-name>

<param-value>

jdbc:mysql:///test

</param-value>

</context-param>

<!-- Filter and listener configurations for Chapter 18 -->

<filter>

<filter-name>accessControl</filter-name>

<filter-class>

com.ora.jsp.servlets.AccessControlFilter

</filter-class>

<init-param>

<param-name>loginPage</param-name>

<param-value>/ch18/login.jsp</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>accessControl</filter-name>

<url-pattern>/ch18/protected/*</url-pattern>

</filter-mapping>

<listener>

<listener-class>

com.ora.jsp.servlets.ResourceManagerListener

</listener-class>

</listener>

<listener>

<listener-class>

com.ora.jsp.servlets.SessionCounterListener

</listener-class>

</listener>

<!-- Servlet for showing JSP source. NOTE! Remove this in production -->

<servlet>

<servlet-name>jspSource</servlet-name>

<servlet-class>JSPSourceServlet</servlet-class>

</servlet>

<!--

Servlet for handling both servlet and JSP errors, see Chapter 18

-->

<servlet>

<servlet-name>errorDispatcher</servlet-name>

<servlet-class>com.ora.jsp.servlets.ErrorDispatcherServlet</servlet-class>

<init-param>

<param-name>errorPage</param-name>

<param-value>/ch9/errorpage.jsp?debug=resp</param-value>

</init-param>

</servlet>

<!-- Struts Controller servlet, see Chapter 18 -->

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>jspSource</servlet-name>

<url-pattern>/jspSource/*</url-pattern>

</servlet-mapping>

<servlet-mapping>

<servlet-name>errorDispatcher</servlet-name>

<url-pattern>/errorDispatcher</url-pattern>

</servlet-mapping>

<!-- Struts Controller servlet mapping, see Chapter 18 -->

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>

<!-- The Welcome File List -->

<welcome-file-list>

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

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

</welcome-file-list>

<!--

Uncomment if you want all exceptions and 500 status codes to

be handled by the customized error page.

<error-page>

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

<location>/errorDispatcher</location>

</error-page>

<error-page>

<error-code>500</error-code>

<location>/errorDispatcher</location>

</error-page>

-->

<!--

This resource reference is only used to test the JNDI config described

in Chapter 23. None of the examples use it.

-->

<resource-ref>

<description>

JNDI DataSource for example database

</description>

<res-ref-name>jdbc/Example</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

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

<res-sharing-scope>Sharable</res-sharing-scope>

</resource-ref>

<!-- Security constraints for examples in Chapter 12 -->

<security-constraint>

<web-resource-collection>

<web-resource-name>admin</web-resource-name>

<url-pattern>/ch12/admin/*</url-pattern>

<url-pattern>/ch12/search/delete.jsp</url-pattern>

</web-resource-collection>

<auth-constraint>

<role-name>admin</role-name>

</auth-constraint>

</security-constraint>

<security-constraint>

<web-resource-collection>

<web-resource-name>search</web-resource-name>

<url-pattern>/ch12/search/*</url-pattern>

</web-resource-collection>

<auth-constraint>

<role-name>admin</role-name>

<role-name>user</role-name>

</auth-constraint>

</security-constraint>

<login-config>

<auth-method>BASIC</auth-method>

<realm-name>ORA Examples</realm-name>

</login-config>

<security-role>

<role-name>admin</role-name>

</security-role>

<security-role>

<role-name>user</role-name>

</security-role>

</web-app>

另外在网上找到了一个家伙写的web.xml

<?xml version="1.0" encoding="UTF-8"?>

<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">

<taglib>

<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>

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

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>

<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>

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

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>

<taglib-location>/WEB-INF/c-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>

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

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>

<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>

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

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>

<taglib-location>/WEB-INF/x-rt.tld</taglib-location>

</taglib>

<session-config>

<session-timeout>

30

</session-timeout>

</session-config>

<welcome-file-list>

<welcome-file>

index.jsp

</welcome-file>

</welcome-file-list>

</web-app>

两个都可以使用,我有些糊涂了,究竟在web.xml 中到底是要申明些什么,起到什么作用呢?

知道的请告诉我,谢谢!

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有