tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Labanowski <...@osc.edu>
Subject <init-param> in /test
Date Sat, 01 Apr 2000 01:56:32 GMT
Small bug to fix, but for me it took a good hour to get it (I was born slow...)

Tomcat 3.1 Beta 1, Apache 1.3.12, both RH 6.1 linux and Solaris 2.7

If you mount <TOMCAT_HOME>/webapps/test/ in tomcat.conf as:
  ApJServMount /test /root
and you play with it on tomcat port, e.g.:

          http://xxx.xxx.xxx:8080/test/servlet/ServletParam

your response is:

   <html>
   <body>
   <h1>ServletParam</h1>
   <dl>
   </dl>
   </body></html>

To my surprise (after reading <TOMCAT_HOME>/webapps/test/WEB-INF/web.xml) the 
    http://xxx.xxx.xxx:8080/test/servlet/servletParam1
and 
    http://xxx.xxx.xxx:8080/test/servlet/servletParam2

gave the same response and the "naked servlet" with no init-params


However, when I replaced the following fragment:

================================
    <servlet>
        <servlet-name>
            servletParam1
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>
                param1
            </param-name>
            <param-value>
                value1
            </param-value>
        </init-param>
        <init-param>
            <param-name>
                param2
            </param-name>
            <param-value>
                value2
            </param-value>
        </init-param>
    </servlet>

    <servlet>
        <servlet-name>
            servletParam2
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>
                param3
            </param-name>
            <param-value>
            </param-value>
        </init-param>
        <init-param>
            <param-name>
                param4
            </param-name>
            <param-value>
                value4
            </param-value>
        </init-param>
    </servlet>

=======================

With the following fragment:

=======================================
    <servlet>
        <servlet-name>
            servletParam1
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>param1</param-name>
            <param-value>value1</param-value>
        </init-param>
        <init-param>
            <param-name>param2</param-name>
            <param-value>value2</param-value>
        </init-param>
    </servlet>
    <servlet>
        <servlet-name>
            servletParam2
        </servlet-name>
        <servlet-class>
            ServletParam
        </servlet-class>
        <init-param>
            <param-name>param3</param-name>
            <param-value>value3</param-value>
        </init-param>
        <init-param>
            <param-name>param4</param-name>
            <param-value>value4</param-value>
        </init-param>
    </servlet>
=================================

i.e., when I removed the white space from around the tags
I got correct responses, e.g., the:
  http://xxx.xxx.xxx:8080/test/servlet/servletParam1
gives me:

<html>
<body>
<h1>servletParam1</h1>
<dl>
<dt>param2</dt><dd>value2</dd>
<dt>param1</dt><dd>value1</dd>
</dl>
</body></html>

Conclusion:  White space should be removed from around initialized
parameters, and the file <TOMCAT_HOME>/webapps/test/WEB-INF/web.xml is BAD.

Try it yourself, if you do not believe me. I do not want to go into
"Should XML parser remove the white space?" here...
I like it as is, but the fact remains... Keep the good work... Thanks for
everything...


Jan
jkl@osc.edu

Jan K. Labanowski            |    phone: 614-292-9279,  FAX: 614-292-7168
Ohio Supercomputer Center    |    Internet: jkl@osc.edu 
1224 Kinnear Rd,             |    http://www.ccl.net/chemistry.html
Columbus, OH 43212-1163      |    http://www.osc.edu/


Mime
View raw message