Def*_*ity 5 forms scope struts-1 struts-config
我一直在寻找一个具体的答案,因为谷歌回复了很多很老的帖子.这是greetingActionForm在请求范围内还是在会话范围内?有没有除了任何位置action,并form-bean声明以确定窗体的范围是什么?
<action-mappings>
<action path="/hello/my/oldfriend"
type="com.imFine.HowAreYouAction"
name="greetingActionForm"
validate="true"
input="/the/front/door">
<forward name="success" path="/go/get/drinks.do" />
</action>
</action-mappings>
<form-beans>
<form-bean name="greetingActionForm" type="com.forms.GreetingActionForm"/>
</form-beans>
Run Code Online (Sandbox Code Playgroud)
小智 9
如果未指定,默认情况下ActionForm将具有范围session.
ActionForm的范围在<action>配置为属性中指定scope.你可以在Struts DTD中找到它:
The "action" element describes an ActionMapping object that is to be used
to process a request for a specific module-relative URI. The following
attributes are defined:
.....
.....
scope The context ("request" or "session") that is used to
access our ActionForm bean, if any. Optional if "name" is
specified, else not valid. [session]
.....
.....
Run Code Online (Sandbox Code Playgroud)
此值在org.apache.struts.config.ActionConfig类中初始化,该类表示Struts模块配置文件中元素的配置信息:
/**
* <p> Identifier of the scope ("request" or "session") within which our
* form bean is accessed, if any. </p>
*/
protected String scope = "session";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13544 次 |
| 最近记录: |