You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ivo <iv...@pletikosic.com> on 2004/09/30 03:35:00 UTC

Handling POST in VelocityServlet

Hello all,

Pardon if this appear to be a very simple question to
those more familiar with Velocity than I but I am
obviously missing something.

I am extending VelocityServlet, with the following
sample code

	public Template handleRequest(HttpServletRequest
request, HttpServletResponse response, Context
context) throws ServletException, IOException
	{
	    
        Enumeration enum =
request.getParameterNames();
        while(enum.hasMoreElements())
        {
            String param = (String)
enum.nextElement();
            System.out.println(param);
        }
	}

When handling a <form> with action='GET' the code
above prints out all the form elements names. If I
switch the <form> to use action='POST' then
request.getParameterNames(); returns nothing.

I get identical behavior if instead of implementing
handleRequest() I implement doPost() and doGet(). The
call to doGet() prints out the paramter names but
doPost() prints nothing.

What am I missing?

Thank you,

Ivo

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Handling POST in VelocityServlet

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Ivo,

> When handling a <form> with action='GET' the code
> above prints out all the form elements names. If I
> switch the <form> to use action='POST' then
> request.getParameterNames(); returns nothing.
I'm sure you mean method='GET/POST', but it works both ways for me.  At
least is works using Velocity 1.4 on Tomcat 5.0.

Could you provide us the minimal information to reproduce this?

Best regards,
-- Shinobu Kawai


--
Shinobu Kawai <sh...@gmail.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org