Got it that doctype was refering to 2.3 DTD. I removed docType from web.xml and give following web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name></display-name>
<description></description>
<jsp-config>
<jsp-property-group>
<url-pattern>*.do</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
</jsp-config>
<servlet>
<servlet-name>JSPTest</servlet-name>
<description>Chapter JSP test</description>
<jsp-file>/BasicCounter.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>JSPTest</servlet-name>
<url-pattern>/BasicCounter.do</url-pattern>
</servlet-mapping>
</web-app>
It is giving error "Document root element must match DOCTYPE root = null. What does that mean? How to rectify this.