0

我正在处理一些代码:

verify_scan_image_main.jsp

......

<s:form id="scanImageReportFrom" action="" method="post">
    ......
    <tr>

        <td align="left" width="12%">
            <s:submit type="button" label="Find" onclick="return goFind();" 
                    method="verifyScanImage" style="width:60px" theme="simple" />
        </td>
    </tr>
</s:form>

<script language="JavaScript">
function goFind()
{
    ......

    scanImageReportFrom.action = 'scanimagereport/verifyScanImage.action';
    scanImageReportFrom.submit();
    return false;
}
</script>

struts.xml

<struts>
    ......

    <package name="scanimagereport" extends="struts-default">
        ......

        <action name="verifyScanImage"
               class="hk.net.scanimagereport.action.VerifyScanImageAction" 
               method="verifyScanImage">
            <result name="success">/verify_scan_image_main.jsp</result>
            <result name="input">/verify_scan_image_main.jsp</result>
        </action>       
    </package>
</struts>

在上面的代码中,如果我goFind()如下改变函数,结果是不一样的。我不明白为什么。

<script language="JavaScript">
  function goFind()
  {
     ......

     //scanImageReportFrom.action = 'scanimagereport/verifyScanImage.action';
     //scanImageReportFrom.submit();
     //return false;
     return true;
  }
</script>
4

1 回答 1

0

您应该onsubmit在单击时处理事件。

否则,它将""根据您的 action 属性使用 method提交给 action verifyScanImage()

于 2013-07-12T09:07:23.150 回答