手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>程序设计>Java技术>列表

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

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

到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.

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!