java - Portlet 生命周期和初始化

标签 java tomcat servlets portlet

我不清楚 Portletinit 方法何时被调用。它是在容器实例化时还是在对 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/

相关文章:

java - 如何为 servlet 的 init() 方法抛出异常

java - 添加在 @PrepareForTest 中编写 Junit 的类可以使 Sonar 覆盖率为零

java - 本地主机上的服务器 Apache TomEE 无法启动

java - 从sqlite数据库Android检索数据时捕获异常

java - 重新部署war时需要重启tomcat吗?

spring - 基于 spring-boot 项目构建可部署的 WAR

java - 将变量从 Servlet 发送到 JSP

java - Servlet 在本地 Windows 上工作,但在 Linux 上不工作

java - 如何将新的 JVM 附加到生成的 Python 进程?

java - 寻找 Dagger 辅助注入(inject)的示例