开发者

Dispatcher forward method from POST to GET

开发者 https://www.devze.com 2023-04-12 13:26 出处:网络
I need to forward from my FooServlet doPost method to BarServlet doGet method. Is there a way to solve this?

I need to forward from my FooServlet doPost method to BarServlet doGet method. Is there a way to solve this?

Currently I'm calling the doGet method from my doPost but I'm sure that this isn't the best p开发者_运维百科ractice.


Assuming HTTP servlets intended for web-based use, I would recommend a ServletResponse.sendRedirect(...) to have the client request service from BarServlet in order to convey some insight into the server's view on things, and to avoid unintended re-POSTs, and so on.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号