> I have already tried the following:

I agree that this could be caused by encoding issues; as you have
already attempted to change in order to rectify the situation.  

Just an idea...  Have you tried changing the method type to "get" and
losing the encoding type?  The name/value pairs (form data set) for your
data in the form submission are assembled differently depending on which
method you choose (see HTML 4.0 spec).


james 

-----Original Message-----
From: Jair da Silva Ferreira Jr [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 19, 2006 10:26 AM
To: users@tomcat.apache.org
Subject: problem with lost request parameters

Hi,
    I have my web application hosted at brazilian Locaweb. It runs on a 
Linux as40-32bits server with tomcat 5.5.15 and java 5. My application 
runs with many (I don't know exactly how many) others in the same tomcat

server. My application uses postgresql 8 database, hibernate 2.1.7c, 
servlet 2.4, jsp 2.0, jstl 1.1 and tiles without struts.

    My problem is that I can't get the request parameters submitted by 
some of my users. My form uses the post method to submit its data. When 
I call request.getParameter("validationScheme") in my servlet I get 
null. request.getParametersNames() also returns an empty Enumeration. My

servlet then throws a ServletException because it can't find a mandatory

parameter. I have never experienced this problem in forms that use the 
"get" method to submit its data. My form has few parameters, they are: 
validationScheme (hidden), email and password. It is a simple login 
form. Here is the relevant html code for my form:
   
<form action="<c:url value="v.servlet"/>" method="post" style="margin:0"

enctype="application/x-www-form-urlencoded" accept-charset="ISO-8859-1">
    <table width="153"  border="0" cellspacing="2" cellpadding="0">
        <tr align="left">
        <td width="30%" class="textologin" 
align="right"><strong>e-mail</strong></td>
        <td width="70%"><input name="email" type="text" class="combos" 
size="17" maxlength="50"></td>
        </tr>
        <tr align="left">
        <td width="30%" class="textologin" 
align="right"><strong>senha</strong></td>
        <td width="70%"><input name="password" type="password" 
class="combos" size="10">
        <input name="validationScheme" type="hidden" value="loginUsual">
        <input type="submit" value="ok" class="botaook"></td>
        </tr>
    </table>
    </form>

    I have already tried the following:
       - adding <%@ page contentType="text/html; charset=ISO-8859-1" %> 
declaration in all my jsp pages;
       - adding  <form ... enctype="application/x-www-form-urlencoded" 
accept-charset="ISO-8859-1"> attributes in all my html forms;
       - adding <meta http-equiv="Content-Type" content="text/html; 
charset=ISO-8859-1"> in all my jsp and html pages;
       - adding a filter that sets the request character encoding to 
ISO-8859-1 (request.setCharacterEncoding("ISO-8859-1")). This filter is 
executed for every jsp and servlet in my application;
       - searched the web for "tomcat lost request parameter" and 
"tomcat lose request parameter" using google and found nothing that 
could help me;

    I asked the support people from Locaweb to execute tcpdump while my 
user tried to submit the form. tcpdump results showed that the request 
parameters are getting to tomcat correctly. So, I think that tomcat is 
losing these parameters for some reason that I don't understand.

    I also noticed that these errors don't happen to all of my users, 
but when it happens to a specific user, it can be easily reproduced by 
that user. Unfortunately, I have never been able to reproduce the error 
in my machines.

    Here is some user information logged by my error page when the 
problem happens:
=======
user 1
=======
Thu Jan 19 11:45:05 BRST 2006
Request that failed: /v.servlet
Status code: 500
Protocol: HTTP/1.0
Remote Address: 201.9.198.113
Remote Host: 201.9.198.113
Remote Port: 0
Local Address:
Local Name: www.dvdfilme.com.br
Local Port: 80
Server Name: www.dvdfilme.com.br
Server Port: 80
User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; 
FunWebProducts)
Request Character Encoding: ISO-8859-1
Request Content-type: application/x-www-form-urlencoded
Response Character Encoding: ISO-8859-1
Response Content-type: text/html
Request Locale: pt_BR
Response Locale: pt_BR
Throwable: javax.servlet.ServletException: 'validationScheme' request 
parameter not found
.... (exception stack trace)
request parameters: {}

=======
user 2
=======
Thu Jan 19 12:13:37 BRST 2006
Request that failed: /v.servlet
Status code: 500
Protocol: HTTP/1.1
Remote Address: 201.29.118.23
Remote Host: 201.29.118.23
Remote Port: 0
Local Address:
Local Name: www.dvdfilme.com.br
Local Port: 80
Server Name: www.dvdfilme.com.br
Server Port: 80
User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Request Character Encoding: ISO-8859-1
Request Content-type: application/x-www-form-urlencoded
Response Character Encoding: ISO-8859-1
Response Content-type: text/html
Request Locale: pt_BR
Response Locale: pt_BR
Throwable: javax.servlet.ServletException: 'validationScheme' request 
parameter not found
.... (exception stack trace)
request parameters: {}

    I also looked at tomcat 5.5.15 source code, class 
org.apache.coyote.tomcat4.CoyoteRequest, method parseRequestParameters()

and noticed that expections (Throwable) are "swallowed" in request 
parameter processing. So, I think that if any problem happens during 
this process, the code will silently ignore the request parameter. I 
also think that this is what is happening in my case. Here is the 
relevant part of the code:

    /**
     * Parse request parameters.
     */
    protected void parseRequestParameters() {
        ....
        int len = getContentLength();

        if (len > 0) {
            try {
                byte[] formData = null;
                if (len < CACHED_POST_LEN) {
                    if (postData == null)
                        postData = new byte[CACHED_POST_LEN];
                    formData = postData;
                } else {
                    formData = new byte[len];
                }
                int actualLen = readPostBody(formData, len);
                if (actualLen == len) {
                    parameters.processParameters(formData, 0, len);
                }
            } catch (Throwable t) {
                ; // Ignore
            }
        }
    }

    Please, is there anything else I can do to fix this problem? Do you 
have any ideas to help me? Any help would be really appreciated.
    Thank you very much for your help.

Thanks,
    Jair Jr

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to