aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Ordering of elements in DD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Ordering of elements in DD" Watch "Ordering of elements in DD" New topic
Author

Ordering of elements in DD

Vineela Devi
Ranch Hand

Joined: Dec 20, 2003
Posts: 191
Hi,

Do we need to follow any specific order while declaring the elements in DD?

Regards,
Vineela
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
I don't thing so.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

For the elements directlry under the <web-app> there is no specific order as per DD for servlet 2.4. But the sub-elements under the <web-app> elements, i think the order is still specific. As per the Servlet 2.3 the order is specific.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Vineela Devi
Ranch Hand

Joined: Dec 20, 2003
Posts: 191
Hi,

I have tried this.But its throwing an error when the app is deployed

<servlet-mapping>
<url-pattern>*.abc</url-pattern>
<servlet-name>BeerSelect</servlet-name>
</servlet-mapping>

<servlet>
<servlet-class>com.example.web.BeerSelect</servlet-class>
<servlet-name>BeerSelect</servlet-name>
</servlet>

and reg the ordering of the subelements I dont think there is any specific order.

Please clarify.

Regards
Vineela
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Definitely you will get error. What you had done is

Read-Before-Declaration

Only when the container is able the read the servlet name specified in <Servlet-class> element it will load the servlet class. Before loading the class how can you access it.
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

Accoprding to Servlet 2.4, the subelement under web-app doesn't matter. But the order of subelement of subelement of <web-app> does matter.

I tried the following in tomcat 5.5.7

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>*.abc</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>mypackage.MyServlet</servlet-class>
</servlet>

Giving me deplyment error.

I tried the same example on Sun Java App Server 8.1 UR2. There is no error, The application is running fine.

If I change the order of <url-pattern> and <servlet-name> , the application can not deply on both servers.

so Sun Java App Server 8.1 UR2 working accroding to the Servlet 2.4 specs.

Hope this help.

Thanks
Vineela Devi
Ranch Hand

Joined: Dec 20, 2003
Posts: 191
Hi,

I have changed interchanging the order of url-pattern and servlet-name and also sub-elements of some other elements.Those are working perfectly fine.

Iam using Tomcat 5.5


<servlet>
<servlet-name>BeerSelect</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<url-pattern>*.abc</url-pattern>
<servlet-name>BeerSelect</servlet-name>
</servlet-mapping>

is working fine in Tomcat.



Regards,
Vineela
[ November 19, 2005: Message edited by: Vineela Devi ]
 
jQuery in Action, 2nd edition
 
subject: Ordering of elements in DD