child element order of web-app

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

child element order of web-app

Shinji Miyamoto
Hi,


In Servlet API 2.4,
child elements of web-app can be specified in arbitrary order.
So, web.xml(A) is valid in 2.4(invalid in 2.3).
But, web.xml(B) is cause error as follows(error message).

Is web.xml(B) invalid for servlet specification ?
or are there any other reason of error ?



web.xml(A)
-------------------------------------------------
<web-app version="2.4">

    <servlet-mapping>
        <servlet-name>ServletA</servlet-name>
        <url-pattern>/ServletA</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ServletA</servlet-name>
        <servlet-class>ServletA</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ServletB</servlet-name>
        <url-pattern>/ServletB</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ServletB</servlet-name>
        <servlet-class>ServletB</servlet-class>
    </servlet>

</web-app>
-------------------------------------------------


web.xml(B)
-------------------------------------------------
<web-app version="2.4">

    <servlet>
        <servlet-name>ServletA</servlet-name>
        <servlet-class>ServletA</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>ServletA</servlet-name>
        <url-pattern>/ServletA</url-pattern>
    </servlet-mapping>

</web-app>
-------------------------------------------------


error message
-------------------------------------------------
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown
servlet
 name ServletA
-------------------------------------------------


environment
-------------------------------------------------
-Windows XP SP2
-JDK 1.5.0_02
-tomcat 5.5.9
-------------------------------------------------



-------------------
Shinji Miyamoto
[hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]