オブジェクトのコレクションを前後に変換するカスタムタイプコンバータを作成しようとしています。フォームにテキストエリアがあり、保存時のテキストエリアの改行ごとにコレクションに新しいオブジェクトを作成したいと考えています。情報を表示するとき、私はCollection内のオブジェクトをループし、テキストエリアの改行を含むStringに変換したいと思う。これまでのところ、私は自分のコンバータに火をつけたり、私が持っているアノテーションに基づいてエラーを受け取ることさえできませんでした。以下は私のクラス定義は次のとおりです。このクラス内Struts 2アクションタイプのアノテーションを使用したリストの変換
@Conversion()
public class FormsEdit extends JWebCrud{
私がリストを持っている:
Formnfieldクラス内private List<Formfield> formFields;
私が設定している:
private Set<Formfieldopts> formfieldoptses = new HashSet<Formfieldopts>(0);
@TypeConversion(converter = "com.webexchange.actions.tpa.setup.forms.FormFieldOptsConverter")
public void setFormfieldoptses(Set<Formfieldopts> formfieldoptses) {
this.formfieldoptses = formfieldoptses;
}
誰かが私を指示してくださいすることができをコンバータを起動させるためにこれらの注釈を適切に設定する方法は?
のStruts 2バージョン:2.2.1
Strutsのインターセプタスタック:
<interceptor-stack name="stackWithSecurity">
<interceptor-ref name="closeHibernateSession" />
<!--catches exceptions pre or post action class-->
<interceptor-ref name="exceptionInterceptor" />
<interceptor-ref name="security">
<param name="excludeMethods">executeNoSecurity,executeNoSecurityOrValidation</param>
</interceptor-ref>
<interceptor-ref name="alias" />
<interceptor-ref name="servletConfig" />
<!-- Puts HTTPResponse and HTTPRequest objects on the action -->
<interceptor-ref name="openHibernateSession" />
<!-- Opens a db connection and creates a hibernate session -->
<interceptor-ref name="prepare" />
<interceptor-ref name="checkbox" /> <!-- Sets unchecked values into the action with a value of 'false' -->
<interceptor-ref name="params" /><!-- Sets the parameters from the HTTP request to the action -->
<interceptor-ref name="staticParams" />
<interceptor-ref name="conversionError" />
<!-- adds a field error when the value can't be converted to the right type -->
<interceptor-ref name="chain">
<!-- these properties should not be copied from one action to another on a chain -->
<param name="excludes">dao</param>
</interceptor-ref>
<interceptor-ref name="validation">
<param name="excludeMethods">
input,back,cancel,browse,delete,executeNoValidation,executeNoSecurityOrValidation,edit
</param>
<param name="validateAnnotatedMethodOnly">true</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">
input,back,cancel,browse,delete,executeNoValidation,executeNoSecurityOrValidation,edit
</param>
</interceptor-ref>
</interceptor-stack>
アクションマッピング:あなたの助けのための
<action name="formsSave"
class="com.webexchange.actions.tpa.setup.forms.FormsEdit"
method="save">
<result name="success">/jsp/centers/tpa/setup/forms/EditForms.jsp
</result>
<result name="input">/jsp/centers/tpa/setup/forms/EditForms.jsp
</result>
</action>
S2バージョン?アクション/インターセプタのスタック設定?スキャンまたは変換プロセスに関するDEBUG/devModeログレベルのものは何ですか? –
S2バージョン:2.2.1 –
私はdevModeにStruts 2設定を持っています。私はまた、ルートロガーのDEBUGをオンにしました。しかし、私はStrutsが何かを出力しているとは思わない。 –