简体   繁体   中英

send a redirection in java servlet doPost() method

I am able to get data from doPost() in java servlet and process the data accordingly. After that, i need to send a redirection response which I am not clear about. I intend to send the redirection page to an external php site.Anyone would share with me how could this be achieved? I have tried response.sendRedirection(URL); in doPost(), but it is not working and not redirect me to any new page.

Thanks for reading.

The method is response.sendRedirect() not response.sendRedirection(). That could be why you're getting the error.

You wrote response.sendRedirection(URL) . The method is called response.sendRedirect(URL) .

Or do you write something in the output before invoking the response.sendRedirect()? Im not sure how jsp handles this but, for example, in php you only can change the header before any actual output is sent.

使用response.sendRedirect(url)代替response.sendRedirection(url)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM