|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectorg.apache.struts.action.ActionForm
ActionFormは1つ以上のActionMappings
に関連づけることのできるJavaBeanです。
このBeanのプロパティは、対応するアクションのexecute
メソッドが呼び出される前に、
対応するリクエストパラメータで初期化されます。
An ActionForm is a JavaBean optionally associated with
one or more ActionMappings. Such a bean will have had its
properties initialized from the corresponding request parameters before
the corresonding action's execute method is called.
Beanのプロパティが設定されると、
アクションのexecuteメソッドが呼び出される前にこのBeanの
validateメソッドが呼び出されます。
これはユーザから提示されたプロパティが正しくて妥当であるかを確かめる機会を
Beanに与えます。
このメソッドで問題が発見された場合、
発生した問題をカプセル化したエラーメッセージオブジェクトを返し、
コントローラServletは対応する入力フォームにコントロールを返します。
また、全てのプロパティが条件に合っていて、
対応するアクションのexecute
メソッドが呼び出されるべきである場合は
validateメソッドはnullを返します。
When the properties of this bean have been populated, but before the
execute method of the action is called, this bean's
validate method will be called, which gives the bean a chance
to verify that the properties submitted by the user are correct and valid.
If this method finds problems, it returns an error messages object that
encapsulates those problems, and the controller servlet will return control
to the corresponding input form. Otherwise, the validate
method returns null, indicating that everything is acceptable
and the corresponding Action's execute method should be
called.
このクラスをインスタンス化するためにサブクラスを作成する必要があります。 サブクラスは公開したい全てのBeanプロパティのためのgetterメソッドと setterメソッドを提供し、 さらににpublicメソッドや protectedメソッドを機能の変更に応じてオーバライドすべきです。
This class must be subclassed in order to be instantiated. Subclasses should provide property getter and setter methods for all of the bean properties they wish to expose, plus override any of the public or protected methods for which they wish to provide modified functionality.
ActionFormsはJavaBeansですので、
JavaBean仕様を満たすようサブクラスも
Serializableを実装すべきです。
いくつかのコンテナでは、
ActionFormsが頼みにしているイントロスペクションAPIを用いるために、
オブジェクトがJavaBeanの全ての要件を満たすことが要求されます。
Because ActionForms are JavaBeans, subclasses should also implement
Serializable, as required by the JavaBean specification.
Some containers require that an object meet all JavaBean requirements
in order to use the introspection API upon which ActionForms rely.
| フィールドの概要 | |
protected MultipartRequestHandler |
multipartRequestHandler
このフォームのMultipartRequestHandlerです。 |
protected ActionServlet |
servlet
結びつけられているコントローラServletのインスタンスです。 |
| コンストラクタの概要 | |
ActionForm()
|
|
| メソッドの概要 | |
MultipartRequestHandler |
getMultipartRequestHandler()
このフォームのMultipartRequestHandlerを返します。 |
protected ActionServlet |
getServlet()
結びつけられているコントローラServletのインスタンスを返します。 |
ActionServletWrapper |
getServletWrapper()
結びつけられているコントローラServletのインスタンスを ActionServletWrapperとして返します。 |
void |
reset(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Beanの全てのプロパティをデフォルトの状態にリセットします。 |
void |
reset(ActionMapping mapping,
javax.servlet.ServletRequest request)
Beanの全てのプロパティをデフォルトの状態にリセットします。 |
void |
setMultipartRequestHandler(MultipartRequestHandler multipartRequestHandler)
ファイルアップロードを扱う際に使用するために与えられたHandlerを設定します。 |
void |
setServlet(ActionServlet servlet)
結びつけられているコントローラServletのインスタンスをセットします ( servletがnullでない場合)。
|
ActionErrors |
validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
HTTPリクエストにセットされているプロパティの妥当性を検証して、 見つかった全ての検証エラーをカプセル化した ActionErrorsオブジェクトを返します。
|
ActionErrors |
validate(ActionMapping mapping,
javax.servlet.ServletRequest request)
非HTTPリクエストにセットされているプロパティの妥当性を検証して、 見つかった全ての検証エラーをカプセル化した ActionErrorsオブジェクトを返します。
|
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
protected transient ActionServlet servlet
protected transient MultipartRequestHandler multipartRequestHandler
nullのこともあります。
null.
| コンストラクタの詳細 |
public ActionForm()
| メソッドの詳細 |
protected ActionServlet getServlet()
public ActionServletWrapper getServletWrapper()
ActionServletWrapperpublic MultipartRequestHandler getMultipartRequestHandler()
nullを返します。
null if this form's enctype is not
"multipart/request-data".
MultipartRequestHandlerpublic void setServlet(ActionServlet servlet)
servletがnullでない場合)。
また、割り当てられた全てのリソースを解放します
(servletがnullである場合)。
servlet is non-null), or release any allocated resources
(if servlet is null).
servlet - もしあれば、新しいコントローラServlet
public void setMultipartRequestHandler(MultipartRequestHandler multipartRequestHandler)
multipartRequestHandler - ファイルアップロードに使用するHandler。
public void reset(ActionMapping mapping,
javax.servlet.ServletRequest request)
デフォルトの実装はこのメソッドのHTTPバージョンにフォワードします。
The default implementation attempts to forward to the HTTP version of this method.
mapping - このインスタンスを選択するために用いられたマッピング
request - 処理しているServletリクエスト
public void reset(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
デフォルトの実装は何もしません。 サブクラスは全てのBeanプロパティをデフォルトの値にリセットするためにこのメソッドをオーバライドすべきです。
The default implementation does nothing. Subclasses should override this method to reset all bean properties to default values.
「更新」タイプのページに関しては、 このメソッドはフォームの値を初期化する場所としてはふさわしくありません (値の初期化はセットアップ用のActionの中で行なうべきです)。 チェックボックスの値をfalseに設定することについて主に気にする必要がありますが、 ほとんどの場合はこのメソッドを実装しないでおいて構いません。
This method is not the appropriate place to initialize form values for an "update" type page (this should be done in a setup Action). You mainly need to worry about setting checkbox values to false; most of the time you can leave this method unimplemented.
mapping - このインスタンスを選択するために用いられたマッピング
request - 処理しているServletリクエスト
public ActionErrors validate(ActionMapping mapping,
javax.servlet.ServletRequest request)
ActionErrorsオブジェクトを返します。
エラーが見つからなかった場合はnull
もしくはエラーメッセージが何も記録されていない
ActionErrorsオブジェクトを返します。
ActionErrors object that encapsulates any
validation errors that have been found. If no errors are found, return
null or an ActionErrors object with no
recorded error messages.デフォルトの実装はこのメソッドのHTTPバージョンにフォワードします。
The default implementation attempts to forward to the HTTP version of this method.
mapping - このインスタンスを選択するために用いられたマッピング
request - 処理しているServletリクエスト
public ActionErrors validate(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
ActionErrorsオブジェクトを返します。
エラーが見つからなかった場合はnull
もしくはエラーメッセージが何も記録されていない
ActionErrorsオブジェクトを返します。
ActionErrors object that encapsulates any
validation errors that have been found. If no errors are found,
return null or an ActionErrors object with
no recorded error messages.
デフォルトの実装は何の検証も行なわずにnullを返します。
サブクラスは独自の妥当性の検証を行なうためにこのメソッドをオーバライドしなくてはいけません。
The default ipmlementation performs no validation and returns
null. Subclasses must override this method to provide
any validation they wish to perform.
mapping - このインスタンスを選択するために用いられたマッピング
request - 処理しているServletリクエスト
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||