tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42343] New: - Posted parameters are not available
Date Mon, 07 May 2007 05:05:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42343>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42343

           Summary: Posted parameters are not available
           Product: Tomcat 6
           Version: 6.0.10
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: tedman@sfu.ca


when submitting a form post with parameters, if you post to a directory instead
of an exact file you don't receive the form post parameters.

As an example if you have a web page with

 <form method="post" action="/test" >
    parameter1 <input type="text" name="parameter1" /> <br />
    parameter2 <input type="text" name="parameter2" /> <br />
    parameter3 <input type="text" name="parameter3" /> <br />
    <input type="submit" />
 </form>

where /test is the contextPath or a directory

if you have a ServletFilter, the filter will not get the parameters, i.e. if I
have request.getParameter("parameter1"); it will return null. Also if I have an
index.jsp in the test directory (or contextRoot) and I do request.getParameter()
from the page, I also don't get the parameters.

If I change the form action to action="/test/index.jsp" both the filter and the
index.jsp will receive the post parameters as expected.

I should also note that I'm fairly sure this worked in tomcat 5.5.20 as I had
working code for that which now doesn't work in tomcat 6.0.10

Some additional information is as follows 
   Linux version 2.6.11-1.1369_FC4 (fedora core 4)
   java full version "1.6.0-b105"
   tomcat 6.0.10

The code I used for getting the parameters was 
	
	public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException
    {
		System.err.println("*** doFilter()");
	    		
		Map parameters=request.getParameterMap();
		for (Object o : parameters.entrySet())
		{
			Map.Entry entry=(Map.Entry)o;
			System.err.println("Entry: "+entry.getKey()+'='+entry.getValue());
		}
		
	    chain.doFilter(request, response);
    }
    
My web.xml was configured as follows 

	<filter>
		<filter-name>TestFilter</filter-name>
		<filter-class>TestFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>TestFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message