简体   繁体   English

在对Struts 1进行操作之前确认对话框

[英]Confirm dialog before action call on Struts 1

On my Struts 1 project I have a form with a submit button that redirects to a Java action class, but now I need a confirm dialog (eventually customizable) that asks for a confirm. 在我的Struts 1项目中,我有一个带有提交按钮的表单,该表单重定向到Java动作类,但是现在我需要一个确认对话框(最终可自定义),要求进行确认。

How can I do this on Struts/JSP? 如何在Struts / JSP上执行此操作?

<html:form action="/Login">
    <html:hidden property="saveCheck" />
        User Name : <html:text name="LoginForm" property="userName" />
    <br>
        Password  : <html:password name="LoginForm"
        property="password" />
    <br>
    <html:submit property="method" value="Login"/>
</html:form>

The easiest way is you can use the onclick event to make a confirm before you submit: 最简单的方法是,您可以在提交之前使用onclick事件进行确认:

<html:submit property="method" value="Login" onclick="javascript:return confirm('are you sure?');"/>

Similar action when you use a custom dialog. 使用自定义对话框时的类似操作。

If the solution is not meet your require, please give us more detail. 如果解决方案不能满足您的要求,请给我们提供更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM