我不清楚 Portlet
的 init
方法何时被调用。它是在容器实例化时还是在对 portlet 发出第一个请求时调用?
它与 Servlet#init
具有相同的行为吗?
最佳答案
这取决于容器。来自 the Portlet 2.0 spec :
PLT.5.2.1 Loading and Instantiation
The portlet container is responsible for loading and instantiating portlets. The loading and instantiation can occur when the portlet container starts the portlet application, or delayed until the portlet container determines the portlet is needed to service a request.
...
PLT.5.2.2 Initialization
After the portlet object is instantiated, the portlet container must initialize the portlet before invoking it to handle requests.
关于java - Portlet 生命周期和初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12577884/