0

I'm working on a Java EE project. I want to add a chart to my JSP page so I searched and found 'AnyChart.jar' library. When I want to use this in JSP, I need to write some infos into web.xml deployment descriptor. My descriptor should look like this to work it properly:

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

but I have already some information in descriptor :

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

My question: how to merge those two files to work it properly? I tried to merge it like this, but it doesnt work:

<?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>
Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
simon77
  • 89
  • 1
  • 9

0 Answers0