It isn't against the HTTP specification to sendRedirect (which in Tomcat
will result in a 302 response).  It's just that very few (if any) browsers
actually implement the spec in this area.  Most of them will respond by
doing a GET to the new URL, instead of a POST (which is what the RFC says to
do).

If you wanted to be completely safe with broken browsers, then you should
also add the POSTed parameters to the query string in your example below.

"Julius Davies" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

Hello, Tomcat User's List,

There was some talk a few days ago about "response.sendRedirect()" after a
POST request being against the HTTP specification...  is that really true?
For example, would this be a problem?  IE and Netscape seem to do what I
want!


// This is common trick I use after a form submission to
// help make navigation easier for the user, and to help
// avoid dual-submission of the same form.
//
// "request" is an HttpServletRequest and "response"
// is an HttpServletResponse.

if ( "POST".equalsIgnoreCase( request.getMethod() ) )
{
   StringBuffer buf = new StringBuffer();
   buf.append( request.getRequestURI() );
   buf.append( "?" );
   buf.append( request.getQueryString() );
   response.sendRedirect( buf.toString() );
   return;
}


I would appreciate any advice anyone might have.


yours,

Julius Davies, Programmer, CUCBC
Email: [EMAIL PROTECTED], Ph: 604.730.6385

This email represents my personal opinions and concerns and not those of
CUCBC.




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

Reply via email to