雪里跪求、、、、、struts2 action 方法中怎么传入request response和响应页面!
时间:2011-10-21
来源:互联网
//action配制
<package name="login" extends="json-default" namespace="/">
<action name="login" class="com.karel.lgy.action.LoginAction" method="login">
<result type="json"></result>
</action>
</package>
//action里方法
public String login() {//怎么在里面配参数request response 响应前台请求??????
try{
loginService.login(uid, pwd);
this.success=true;
session.put("user", u);
}catch(Exception e){
this.message="登录失败:" + e.getMessage();
this.success=false;
}
return SUCCESS;
}
//前台请求
function login(){
mask.show();
fs.getForm().submit({
url:'login!login.action',
success : function(form,action) {
document.location.href = 'index.jsp';
},
failure : function(form,action) {
mask.hide();
Ext.MessageBox.alert('登录失败', action.result.message);
return;
}
});
}
也就是说前台请求时把request reponse也传给login()这个方法????
<package name="login" extends="json-default" namespace="/">
<action name="login" class="com.karel.lgy.action.LoginAction" method="login">
<result type="json"></result>
</action>
</package>
//action里方法
public String login() {//怎么在里面配参数request response 响应前台请求??????
try{
loginService.login(uid, pwd);
this.success=true;
session.put("user", u);
}catch(Exception e){
this.message="登录失败:" + e.getMessage();
this.success=false;
}
return SUCCESS;
}
//前台请求
function login(){
mask.show();
fs.getForm().submit({
url:'login!login.action',
success : function(form,action) {
document.location.href = 'index.jsp';
},
failure : function(form,action) {
mask.hide();
Ext.MessageBox.alert('登录失败', action.result.message);
return;
}
});
}
也就是说前台请求时把request reponse也传给login()这个方法????
作者: liu955x 发布时间: 2011-10-21
你去action中得到servletAPI的方式,有两种,一种是iOC方式,一种是非IOC方式。你就明白了。
作者: licip 发布时间: 2011-10-21
这个我知道,非ioc是通过ActionContext
ioc是实现...Aware接口
我就是想知道,怎么在这个action中的login方法中加个参数,如login(HttpServletRequest request,HttpServletResponse response),我如果直接写成这样,struts2找不到这个方法,
俺是新手,请大家多多照顾、、、、
ioc是实现...Aware接口
我就是想知道,怎么在这个action中的login方法中加个参数,如login(HttpServletRequest request,HttpServletResponse response),我如果直接写成这样,struts2找不到这个方法,
俺是新手,请大家多多照顾、、、、
作者: liu955x 发布时间: 2011-10-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28