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.
How can I do this on 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:
<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.