Servlet接口的service()方法
红色部分我不懂是什么意思,望高手翻译一下,能翻译多少就翻译多少,先谢谢。
void service(ServletRequest req,
ServletResponse res)
throws
ServletException,
IOException方法说明:
Called by the servlet container to allow the servlet to respond to a request.
This method is only called after the servlet's init() method has completed successfully.
The status code of the response always should be set for a servlet that throws or sends an error.
Servlets typically run inside multithreaded servlet containers that can handle multiple requests concurrently. Developers must be aware to synchronize access to any shared resources such as files, network connections, and as well as the servlet's class and instance variables.
------解决方案--------------------
1) 对于抛异常或发送错误的servlet, 始终需要设置repsonse的状态值.
2) 开发者必须要知道同步访问共享的资源, 比如....
3) 以及servlet的类变量和实例变量
我的异常网推荐解决方案:Servlet.service() for servlet default threw exception,http://www.myexception.cn/eclipse/181756.html