我正在从事Java EE项目。我想在JSP页面中添加一个图表,以便搜索并找到“AnyChart.jar”#39;图书馆。 当我想在JSP中使用它时,我需要在web.xml部署描述符中写一些信息。我的描述符看起来应该是这样才能正常工作:
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<filter>
<filter-name>AnyChart Resources</filter-name>
<display-name>AnyChart static resources filter</display-name>
<description>
This servlet filter is intended for catch http request
to static AnyChart Component resources (AnyChart.js and AnyChart.swf)
</description>
<filter-class>com.anychart.servlet.ResourceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AnyChart Resources</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
但我在描述符中已有一些信息:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>servlets.LoginServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Configuring</servlet-name>
<servlet-class>servlets.Configuring</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Configuring</servlet-name>
<url-pattern>/Configuring</url-pattern>
</servlet-mapping>
</web-app>
我的问题:如何合并这两个文件才能正常工作?我试图像这样合并它,但它不起作用:
<?xml version="1.0" encoding="UTF-8"?>
<!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 version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>servlets.LoginServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Configuring</servlet-name>
<servlet-class>servlets.Configuring</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Configuring</servlet-name>
<url-pattern>/Configuring</url-pattern>
</servlet-mapping>
<filter>
<filter-name>AnyChart Resources</filter-name>
<display-name>AnyChart static resources filter</display-name>
<description>
This servlet filter is intended for catch http request
to static AnyChart Component resources (AnyChart.js and AnyChart.swf)
</description>
<filter-class>com.anychart.servlet.ResourceFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AnyChart Resources</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>