我的要求是我有一个隐藏的表单,我称之为句柄方法。除了句柄方法,我将成功和错误网址设置为隐藏值。
<dsp:form action="blank.jsp" method="post" formid="UNIQUE_FORM_ID">
<dsp:input bean="FormHandler.commitOrder" type="hidden" value="submit" />
<dsp:input bean="FormHandler.commitOrderSuccessURL" type="hidden" value="SOME_VALUE" />
<dsp:input bean="FormHandler.commitOrderNotReadyURL" type="hidden" value="SOME_VALUE" />
</dsp:form>
我需要在调用handle方法之前设置successurl
和errorUrl
。
我试过优先考虑,但仍然无法正常工作。
谢谢, Neenu
答案 0 :(得分:0)
以下是我测试并运行的代码片段。
<dsp:importbean bean="/atg/commerce/order/purchase/CommitOrderFormHandler"/>
<dsp:form action="blank.jsp" method="post" formid="commitForm">
<dsp:input bean="CommitOrderFormHandler.commitOrderSuccessURL" type="hidden" value="success.jsp" />
<dsp:input bean="CommitOrderFormHandler.commitOrderErrorURL" type="hidden" value="failure.jsp" />
<dsp:input id="submitFormInput" bean="CommitOrderFormHandler.commitOrder" type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</dsp:form>
<%--
If your form (including the submit button) is hidden,
then I assume that elsewhere on the page, you have some
other way to trigger the submission of your hidden form.
--%>
<button type="button" onclick="document.getElementById('submitFormInput').click()">Click Me!</button>
这里有几个要点:
<dsp:input>
type =“submit”和bean="<form handler method you are trying to call>
“。如果必须隐藏它,你可以使用CSS隐藏它。<button>
标记来提交表单,但您可以将其替换为提交方法。