2012-11-16 4 views
5

개체 컬렉션을 문자열에서 앞뒤로 변환하는 사용자 지정 형식 변환기를 만들려고합니다. 내 양식에 텍스트 영역이 있고 저장시 텍스트 영역의 모든 줄 바꿈을 위해 컬렉션에 새 개체를 만들고 싶습니다. 정보를 표시 할 때 Collection의 객체를 반복하고 텍스트 영역에 줄 바꿈이있는 String으로 변환하려고합니다. 지금까지 필자가 가지고있는 주석을 기반으로 변환기를 시작하거나 어떤 종류의 오류도받을 수 없었습니다. 아래는 내 클래스 정의입니다 :Struts 2 작업 유형 변환 (주석 사용)

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; 
} 

누군가가 나에게 직접시겠습니까 : 나는 설정을 가지고있는 Formnfield 클래스 내부

private List<Formfield> formFields; 

:이 클래스 내부

@Conversion() 
public class FormsEdit extends JWebCrud{ 

나는 목록을 변환기를 실행시키기 위해 이러한 특수 효과를 올바르게 설정하는 방법은 무엇입니까?

스트럿츠 2 버전 : 2.2.1

스트럿츠 인터셉터 스택 :

  <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> 
+1

S2 버전? 액션/인터셉터 스택 설정? 스캔 또는 변환 프로세스와 관련하여 DEBUG/devMode 로그 수준의 항목이 있습니까? –

+0

S2 버전 : 2.2.1 –

+0

나는 devMode에 Struts 2 설정을 가지고있다. 또한 루트 로거에 대해 DEBUG를 사용하도록 설정했습니다. 그러나, 나는 Struts가 아무것도 출력하지 않는 것을 본다. –

답변

0

감사 데이브. My s : textarea는 변환하려고하는 콜렉션을 가리키고 있지 않습니다. 내가 한 후에 변환기가 작동하기 시작했다. 내게 얼마나 실패 할까? 미안.