Struts2 Struts 2中的作用域及其标准
Struts 2应用程序中有多少作用域?如果我们在那里使用会话和请求范围,这是否好呢?会话和请求的操作作用域是如何工作的?Struts 2正在运行一个容器,它有bean的作用域。关于bean作用域的更多信息还有疑问。所有其他作用域都是servlet作用域。Struts使用自己的结构间接访问这些作用域。例如,Struts2 Struts 2中的作用域及其标准,struts2,scope,Struts2,Scope,Struts 2应用程序中有多少作用域?如果我们在那里使用会话和请求范围,这是否好呢?会话和请求的操作作用域是如何工作的?Struts 2正在运行一个容器,它有bean的作用域。关于bean作用域的更多信息还有疑问。所有其他作用域都是servlet作用域。Struts使用自己的结构间接访问这些作用域。例如,set标记使用以下范围: 可用范围如下: application - the value will be set in application scope according to servl
set
标记使用以下范围:
可用范围如下:
application - the value will be set in application scope according to servlet spec. using the name as its key
session - the value will be set in session scope according to servlet spec. using the name as key
request - the value will be set in request scope according to servlet spec. using the name as key
page - the value will be set in page scope according to servlet sepc. using the name as key
action - the value will be set in the request scope and Struts' action context using the name as key
注:
如果未指定范围,则默认为操作范围
不清楚你在问什么。S2应用程序仍然是servlet规范工件,因此标准JEE作用域存在。S2添加了另一个“作用域”,即值堆栈,尽管它是根据唯一可用的作用域,即JEE定义的作用域来实现的。@DaveNewton那么请求和会话作用域与值堆栈(操作作用域?)有什么不同呢?值堆栈是S2放置数据的地方。值堆栈包含在JEE评分中(我认为是请求)。我们可以使用操作范围来处理会话吗?可以,因为操作范围比会话范围小。