2013-05-09 3 views
1

아리아 템플릿 양식 http://ariatemplates.com/을 제출하려고하는데 제출이 스프링 MVC 컨트롤러/서블릿에 수행됩니다.아리아 템플릿 - 양식 제출 문제

양식을 제출할 권리가 있지만 컨트롤러에서 날짜 선택기, 텍스트 상자 등의 아리아 요소 값을 가져올 수 없습니다. Request.getParameter은 (는) 사용하지 않습니다.

도움이 될 것입니다.

여기 내 샘플 tpl 파일, js 파일 및 스프링 컨트롤러가 있습니다.

TPL 파일

{Template { 
    $classpath:'view.Turnover', 
    $hasScript : true 
}} 
    {macro main()} 
    <form action="test.do" method="POST" id="turnoverform"> 
    <div style="float:left;padding-top: 3em;padding-bottom: 3em;padding-right: 3em;"> 
    {@aria:Div { 
     sclass : "basic", 
     width : 740, 
     height : 300 
     }} 

     <p style="font-family:Arial,Helvetica,sans-serif;font-size: medium;">Create Turnover Report</p> 
     <hr /> 

     {@aria:DatePicker { 
      label: " begin date:", 
      labelWidth:190, 
      width:330, 
      helptext:"Type date or select", 

     }/} 
     {@aria:DatePicker { 
      margins:"x x x 20", 
      label: "end date:", 
      labelWidth:190, 
      helptext:"Type date or select", 
      width:330, 

     }/} 
     <br/> 
     <br/> 
     <br/> 

     {@aria:TextField { 
      label : "User id", 
      labelPos : "left", 
      helptext : "ID", 
      width : 250, 
      block : true, 
      labelWidth : 80, 
      bind : { 
      "value" : { 
       inside : data, 
       to : 'value' } 
      } 
    }/} 
    <br /> 


    {/@aria:Div} 
    <br /> 
    {@aria:IconButton { 
     icon: "std:confirm", 
     label:"Create", 
     width : 300, 
     tooltip : "Click on this to create a Report", 
     block: true, 
     onclick : { 
     fn : buttonClick 
     } 
    } /} 
    </div> 
    </form> 
{/macro} 
{/Template} 

자바 스크립트 파일 :

Aria.tplScriptDefinition({ 
    $classpath : "view.TurnoverScript", 
    $prototype : { 
    /** 
    * Callback for the click event on the first button. 
    * @param {aria.DomEvent} evt Click event 
    */ 
    buttonClick : function (evt) { 


     aria.core.IO.asyncFormSubmit({ 
      formId : "turnoverform", 
      callback : { 
      fn : this.onSuccess, 
      onerror : this.onError, 
      scope : this 
      } 
     }); 
    }, 

    onSuccess : function (evt, args) { 


     alert("The Template has been created"); 
     //this.$json.setValue(["view:Dialog"], "dialogOpen", true); 

     }, 



     onError : function (evt, args) { 


      alert("The Template has not been created due to some Error"); 

     } 
    } 
}); 
+0

코드 샘플을 게시 할 수 있습니까? 제출 방법은 무엇입니까? [this] (http://ariatemplates.com/usermanual/Form_Submissions)가 도움이됩니까? – dgn

+0

@scenario 이미 이걸 살펴보고 따라 갔지만 문제는 해결되지 않았습니다. 참조 용 샘플 코드 첨부 –

답변

2

아리아 템플릿 당신이 DOM 요소와하지만 데이터 모델 정상적으로 작동하지 않습니다.

당신이 원하는 것을 달성 할 수있는 방법은 bind 재산

{@aria:DatePicker { 
    label: " begin date:", 
    labelWidth:190, 
    width:330, 
    helptext:"Type date or select", 
    bind : { 
     value : { 
      inside : data, 
      to : "begin_date" 
     } 
    } 
}/} 
를 사용하여 데이터 모델에 해당 값을 결합하는 것입니다

귀하의 데이터 모델은 이제 그 값을 포함,이 값을 수정하고 this.data의 콘텐츠를 보려고 것 귀하의 템플릿 스크립트.

는 (응용 프로그램의 복잡성에 따라, 또는 어쩌면 RequestMgr) aria.core.Io.asyncRequest을 통해 당신은 두 가지 옵션이 데이터

  • 템플릿 스크립트를 제출합니다. 이 메서드는 POST 요청의 경우 메시지 본문 인 data 문자열을 사용합니다. 문자열이어야하므로 aria.utils.json.JsonSerializer.serialize()을 사용하여 데이터 모델을 문자열로 변환 할 수 있습니다.

    aria.utils.json.JsonSerializer.serialize (this.data, 설정) 코드 config의 이전 코드에서

는 선택 사항이며, 제공하는 경우이 bean 일치해야합니다. submitJsonRequest 컨트롤러를 사용하는 방법에 대한 좋은 일을 통해

  • 모듈 컨트롤러 템플릿에서 서버에 연결하는 로직을 분리하는 것이 데이터가, 직렬화가 내부적으로 이루어집니다 당신이 직접 객체를 보낼 수 있다는 것입니다. 단점은 액션을 실제 URL로 변환하도록 UrlService을 구성해야 할 것입니다. 기타 정보가 here