is this struts 1.x form bean in session scope or request scope?

http://stackoverflow.com/questions/6795959/is-this-struts-1-x-form-bean-in-session-scope-or-request-scope


If unspecified, by default an ActionForm will have scope session.

The scope of an ActionForm is specified on the <action> configuration as attribute scope. You can find this in the 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]
     .....
     .....

This value is initialized in the org.apache.struts.config.ActionConfig class which represents the configuration information of an element from a Struts module configuration file:

/**
 * <p> Identifier of the scope ("request" or "session") within which our
 * form bean is accessed, if any. </p>
 */
protected String scope = "session";

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章