这会显示一条确认消息,但是当我点击“是”时,它会显示以下错误: HTTP状态415 - description服务器拒绝了此请求,因为请求实体所采用的方法所请求的资源不支持该格式。
{
xtype: 'button',
id: 'passwordRecoveryButton',
text: 'Reset Password',
style: 'border-color: red',
listeners: {
click: function(button, event){
var form = Ext.getCmp('gmiUserDetailsPanel').getForm();
var currentRecord = form.getRecord();
var emailId = currentRecord.get('emailId');
Ext.Msg.show({
title:'Password Recovery',
msg: 'Are you sure you want to send a password recovery email to ' + emailId +'?',
buttons: Ext.Msg.YESNO,
icon: Ext.Msg.QUESTION,
fn: function(btn) {
if (btn === 'yes') {
Ext.Ajax.request({
url: 'admin/passwordRecovery.htm',
jsonData : emailId,
method: 'POST',
success: function(response){
Ext.Msg.show({
msg: 'Email successfully sent to ' + emailId +'.',
})
},
failure: function(response){
Ext.Msg.show({
modal : true,
title : 'Unable to send email!',
msg : 'Unable to send email to : '+emailId+', please contact support team.',
icon : Ext.Msg.ERROR,
buttons: Ext.Msg.OK
});
}
});
}
}
});
}
}
},
},
我试图传递当前记录(或只是电子邮件)的信息,这是在java控制器中:
@RequestMapping(value = "/passwordRecovery", method = RequestMethod.POST)
@Secured("ADMIN")
public
@ResponseBody
UserOperationResponse PasswordRecoveryEmail(Model model, HttpServletRequest request, @RequestBody UserOperationRequest userOperationRequest) throws UnsupportedEncodingException, MessagingException {
UserOperationResponse userOperationResponse = new UserOperationResponse();
[...]