XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 4th, 2003, 12:55 PM
violaplayer violaplayer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 24 violaplayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Later DTD version

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

Reply With Quote
  #2  
Old September 4th, 2003, 01:47 PM
violaplayer violaplayer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 24 violaplayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Later DTD version

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Later DTD version


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway