spring webflow在链接上提交表单

时间:2013-02-19 11:06:54

标签: spring-webflow

我有以下问题。

我想使用SpringWebflow将用户输入的详细信息保存在数据库中。要求是用户必须单击Save as Draft链接而不是提交按钮。

我想捕获用户输入/选择的详细信息并将其作为对象发送(我不想设置请求参数,因为整个流程中有超过20个字段)。

以下是我的代码段。 P.S,没有错误。我可以看到正在写的服务中的日志。

step1.jsp

<form:form commandName="userEnteredCriteria" action="${flowExecutionUrl}" method="post">

<div class="submit-buttons submit-style">
            <input type="submit" name="_eventId_next" value="next"     class="submit-button product-submit"/>
</div>


<p class="return product-submit1"><a href="${flowExecutionUrl}&_eventId=saveDraftStep1">Save as Draft</a></p>

</form:form>

weblflow.xml

<view-state id="Step1">
 <transition on="saveDraftStep1">
 <evaluate expression="myAction.bindAndValidate" /> 
 <evaluate expression="myFlowService.saveDraft(userEnteredCriteria        externalContext.nativeRequest)" />
 </transition>
</view-state>

有人可以帮我解决如何通过链接点击提交表单吗?我知道我必须正确一些javascript(请纠正我,如果我错了)但我不知道如何在javascirpt中做到这一点。我们正在使用JQUERY for javascript。任何示例代码都将是hlp

非常感谢。

1 个答案:

答案 0 :(得分:1)

<input type="submit" id="saveDraftStep1" name="_eventId_saveDraftStep1" value="saveDraftStep1" style="display:none;"/>
<a href onclick="document.getElementById('saveDraftStep1').click();">Click here to save draft</a>