我正在处理一些代码:
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>
答案 0 :(得分:0)
您应该在点击时处理onsubmit
事件,否则它将根据您的操作属性""
提交到操作verifyScanImage
。