且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不提交表单的情况下使用struts2提交标签作为按钮?

更新时间:2022-11-04 12:17:00

如果你使用 s:submit 标签,渲染的 HTML 输出是 inputbutton 标签,但类型是 submit 除了 image 类型.您可以使用代码执行不提交表单的javascript onclick事件.

If you are using s:submit tag the rendered HTML output is either input or button tag but the type is submit except for the image type. You can use the code to execute javascript onclick event that doesn't submit the form.

<s:submit type="button" onclick="return false;"/>