【问题标题】:spring web flow + ajax data transferspring web flow + ajax 数据传输
【发布时间】:2014-03-24 19:34:51
【问题描述】:

我使用 spring mvc 已经有一段时间了,但现在我开始使用 Spring web flow。并尝试使用 swf 轻松创建应用程序。

我的疑问是:

我有一个 JSP,其中我有几个文本框可供用户填充。我想通过flow.xml将此用户数据传输到spring控制器。

那我该怎么做..??

这是我的 jsp(ajax 代码)

    var postData = {};
    postData["school_name"] = $("#school_name").val();
    postData["borrower_address_zip_code"] = $("#borrower_address_zip_code").val();
    postData["student_enrollment"] = $("#student_enrollment").val();
      $.ajax({
        type : 'POST',
        data : JSON.stringify(postData),
        contentType : 'application/json',
        url : '${flowExecutionUrl}&_eventId=handel1&ajaxSource=true',
        cache : false,
        success : function(data) {
        alert('done');
        },
        error : function(jqXHR, textStatus, errorThrown) {
           alert('textStatus'+textStatus + 'errorThrown'+errorThrown);
         }
    });

这是我的 flow.xml。

    <transition on="handel1">
      <!-- requestParameters -->
          <evaluate expression="studentLoan.createProperty(*********)"
              result="flowScope.content123" />
      </transition>

我应该有什么来代替 ***** 以便我可以保存数据并调用控制器中的 createProperty 方法。

通过使用“requestParameters”代替 ****,我已经解决了这个问题。并在查询字符串中传递 javascript 数组。 所以这样好吗??? 或者 如果有其他更好的方法来做同样的事情。那么请告诉我。

【问题讨论】:

    标签: ajax json spring


    【解决方案1】:

    我没有得到任何回应这个问题,所以我更喜欢使用 spring mvc 来解决这个特定问题。

    我意识到 spring webflow 位于 spring mvc 之上,因此可以根据您的应用程序要求使用 mvc + webflow。

    【讨论】:

      猜你喜欢
      • 2012-09-13
      • 2013-11-02
      • 1970-01-01
      • 1970-01-01
      • 2012-06-26
      • 1970-01-01
      • 2012-03-20
      • 2011-06-03
      • 1970-01-01
      相关资源
      最近更新 更多