gpt4 book ai didi

jakarta-ee - servlet 值代表什么

转载 作者:行者123 更新时间:2023-12-02 07:07:19 25 4
gpt4 key购买 nike

我在这里有点困惑。在我们的应用程序中,我们定义了一些 servlet。以下是 web.xml 的摘录对于其中一个 servlet:

<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>com.foo.framework.axis2.http.FrameworkServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>

据我了解 <load-on-startup> 的值必须是正整数才能自动加载。我在谷歌上进行了查找,但我遇到的回复只会让我更加困惑。

最佳答案

Resin 3.0记录此行为:

load-on-startup can specify an (optional) integer value. If the value is 0 or greater, it indicates an order for servlets to be loaded, servlets with higher numbers get loaded after servlets with lower numbers.

JSP 3.1 spec (JSR 340) 在第 14-160 页上这样说:

The element load-on-startup indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the Web application. The element content of this element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the same load-on-startup value.

您可能不仅想检查 JSR,还想检查 Web 容器的文档。可能存在差异

关于jakarta-ee - servlet <load-on-startup> 值代表什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/809775/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com