|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hello all
Someone told me I need to use the later DTD version in order to run the <listener-class> in the web.xml. Sorry I really have no idea what DTD is. Currently I think I am using 2_2.dtd. Also I am using Tomcat 4.1.24 and jdk1.3.1_08. Can anyone tell me where can I download the later DTD version and how to implement it in order to run my <listener-class> when the Tomcat starts? Many thanks Viola |
|
#2
|
|||
|
|||
|
Hi all
I have just put the following code on the top of my 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/j2ee/dtds/web-app_2.3.dtd"> ============================================== And this is my 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/j2ee/dtds/web-app_2.3.dtd"> <web-app> <listener> <listener-class>InterestCounter</listener-class> </listener> <security-constraint> <web-resource-collection> <web-resource-name>Security</web-resource-name> <url-pattern>/client/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>administrator</role-name> <role-name>client</role-name> </auth-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>Security</web-resource-name> <url-pattern>/administrator/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>administrator</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/login.html</form-login-page> <form-error-page>/login_error.html</form-error-page> </form-login-config> </login-config> </web-app> ============================================== Now the Tomcat didnt give me error message, but I am not sure whether the <listener-class> has called my Servlet, InterestCounter. I have put a System.out.println in this Servlet(full code is in my first post), but I couldnt see this println message on the Tomcat DOS screen. Is this means <listener-class> didnt call my Servlet? On the other hand, if I move the whole <listener-class> to the bottom of my web.xml, just before the </web-app>. It gave me error: ============================================== The content of Element type "web-app" must match "<icon?, display name?, description?, distributable?, content param*. servlet*, servlet-mapping, session-config*, mime-mapping*, welcome-file-list*, error-page*, taglib*, resource-ref*, security-constraint*, login-config*, security-role*, env-entry*, ejb-ref*>".> ============================================== Does the location of the <listener-class> is a matter? Tomcat goes fine if I put the <listener-class> just after <web-app>, is that mean it works? How can I ensure it has called my Servlet? Many many thanks Viola |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Later DTD version |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|