我在Struts2 WebApp中工作,并且在尝试发送邮件时不在第一次单击时进行邮件,第二次单击工作。
我正在Struts2 WebApp中工作,并且在尝试发送邮件时,它在第一次单击时无法使用,因为当我单击第二次工作时,并且如果我评论&lt; interceptor-ref name =“ token” /&gt; < /代码>然后首次单击。
时,首先单击时单击。
注意:1。仅在我注释&lt; interceptor-ref name =“ token”/&gt;
这是我的struts.xml
代码
<action name="myActionName" class="actions.myActionName"
method="myActionName">
<interceptor-ref name="token" />
<interceptor-ref name="params" />
<interceptor-ref name="basicStack" />
<exception-mapping result="passRecoveryException"
exception="exceptions.PasswordRecoveryException" />
<result name="success" type="json" />
<result name="passRecoveryException" type="json" />
<result name="invalid.token">/index.jsp</result>
</action>
,我正在使用jQuery在第一次单击时从Frontent发送邮件
$(document).on('click','#myActionNameId',function(){
if($("#username").val() == ""){
showToaster(2,"This field is required."," User name");
return false;
}else if ($("#email").val() == ""){
showToaster(2,"This field is required."," Email ID");
return false;
}/*else if ($("#captchaText").val() == ""){
showToaster(2,"This field is required."," Captcha");
return false;
}*/else if(grecaptcha.getResponse().length==0){
showToaster(2,"Please verify your captcha","Captcha");
return false;
}
else{
$('#loading').show();
var form = $('#forgotPassForm');
var formdata = false;
if (window.FormData){
formdata = new FormData(form[0]);
}
var formAction = form.attr('action');
submitByAjaxWithConfirmwithCallBackJSON(formAction,formdata,function(data){
//alert(data.exception);
if(data.exception==undefined){
if(data.success==true){
$('#loading').hide();
showToaster(1,data.message.split(':')[1],data.message.split(':')[0]);
}else{
showToaster(2,data.message.split(':')[1],data.message.split(':')[0]);
$('#loading').hide();
}
}else{
var msg = data.exception.message.split(':');
showToaster(2,msg[1],msg[0]);
//alert(msg[0]);
$('#loading').hide();
}
})
}
});
,它将转到
if(data.success==true){
$('#loading').hide();
showToaster(1,data.message.split(':')[1],data.message.split(':')[0]);
}else{
showToaster(2,data.message.split(':')[1],data.message.split(':')[0]);
$('#loading').hide();
}
else 零件,但是第二次再次单击以发送其工作正常。
I am working in Struts2 webapp and while trying to send mail it's not working on first click where as when I clicked second time it's working and aslo if I comment the <interceptor-ref name="token" />
then it's working on first click.
NOTE: 1. On first click working only if I comment<interceptor-ref name="token" />
Here's my struts.xml
code
<action name="myActionName" class="actions.myActionName"
method="myActionName">
<interceptor-ref name="token" />
<interceptor-ref name="params" />
<interceptor-ref name="basicStack" />
<exception-mapping result="passRecoveryException"
exception="exceptions.PasswordRecoveryException" />
<result name="success" type="json" />
<result name="passRecoveryException" type="json" />
<result name="invalid.token">/index.jsp</result>
</action>
and I'm sending mail from frontent using jquery
$(document).on('click','#myActionNameId',function(){
if($("#username").val() == ""){
showToaster(2,"This field is required."," User name");
return false;
}else if ($("#email").val() == ""){
showToaster(2,"This field is required."," Email ID");
return false;
}/*else if ($("#captchaText").val() == ""){
showToaster(2,"This field is required."," Captcha");
return false;
}*/else if(grecaptcha.getResponse().length==0){
showToaster(2,"Please verify your captcha","Captcha");
return false;
}
else{
$('#loading').show();
var form = $('#forgotPassForm');
var formdata = false;
if (window.FormData){
formdata = new FormData(form[0]);
}
var formAction = form.attr('action');
submitByAjaxWithConfirmwithCallBackJSON(formAction,formdata,function(data){
//alert(data.exception);
if(data.exception==undefined){
if(data.success==true){
$('#loading').hide();
showToaster(1,data.message.split(':')[1],data.message.split(':')[0]);
}else{
showToaster(2,data.message.split(':')[1],data.message.split(':')[0]);
$('#loading').hide();
}
}else{
var msg = data.exception.message.split(':');
showToaster(2,msg[1],msg[0]);
//alert(msg[0]);
$('#loading').hide();
}
})
}
});
on first click it's going to
if(data.success==true){
$('#loading').hide();
showToaster(1,data.message.split(':')[1],data.message.split(':')[0]);
}else{
showToaster(2,data.message.split(':')[1],data.message.split(':')[0]);
$('#loading').hide();
}
else part but after second time when I again click to send it's working fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论