ExtJs 用Ajax调用后台方法不管用,为何? 10

js源码:<linkrel="stylesheet"type="text/css"href="<%=path%>/js/Ext/resources/css/ext-all... js源码:
<link rel="stylesheet" type="text/css"
href="<%=path%>/js/Ext/resources/css/ext-all.css" />
<script type="text/javascript"
src="<%=path%>/js/Ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/js/Ext/ext-all.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
Ext.get("aaa").on("click",function(){
Ext.Ajax.request({
url:'myCompany.htm?action=seeOnlineCsUser',
params:{'ATTACHEDID':100006157},
success:function(req){
Ext.Msg.alert("ok"+req.responseText);
},
failure:function(){
Ext.Msg.alert(req.responseText+"failure");
}
});
});
});
</script>
java源码:
public ModelAndView seeOnLineCsUser(HttpServletRequest req,
HttpServletResponse res) {
try {
getPage(req);
} catch (Exception e) {
e.printStackTrace();
}
return new ModelAndView("myCompany/myCompanyOnLineCsUser");
}

private void getPage(HttpServletRequest req) throws CompanyServiceException {
String attachedId_s = req.getParameter("ATTACHEDID");
String online_s = req.getParameter("ONLINE");
req.setAttribute("attachedId", attachedId_s);
String currentPageNum_s = req.getParameter("currentPageNum");
String onePageMaxNum_s = req.getParameter("onePageMaxNum");
StringBuffer sb = new StringBuffer();
sb.append("&onePageMaxNum=").append(
NullOfStringToSpace.getNullOfStringToString().execute(
onePageMaxNum_s));
sb.append("&ATTACHEDID=").append(
NullOfStringToSpace.getNullOfStringToString().execute(
attachedId_s));
sb.append("&ONLINE=").append(NullOfStringToSpace.getNullOfStringToString().execute(online_s));
req.setAttribute("parameter", sb.toString());

Integer currentPageNum = null;
Integer onePageMaxNum = null;
Integer online = null;
Integer attachedId = null;
attachedId = StringToInteger.getStringToInteger().toInteger(
attachedId_s);
online = StringToInteger.getStringToInteger().toInteger(online_s);
currentPageNum = StringToInteger.getStringToInteger().toInteger(
currentPageNum_s);
onePageMaxNum = StringToInteger.getStringToInteger().toInteger(
onePageMaxNum_s);
if(onePageMaxNum == null){
onePageMaxNum=20;
}
Pageination page = csUserCompanyBusiness.veiwCsUsersByCondition(
attachedId, currentPageNum, onePageMaxNum, online);
req.setAttribute("page", page);
int onlineNum=csUserCompanyBusiness.getOnlineCsUserNum(attachedId, 1);
req.setAttribute("ONLINE", onlineNum);
int unOnlineNum=csUserCompanyBusiness.getOnlineCsUserNum(attachedId, 0);
req.setAttribute("UNONLINE", unOnlineNum);
int all=csUserCompanyBusiness.getOnlineCsUserNum(attachedId, null);
req.setAttribute("all",all); }
展开
 我来答
换热乎0
2012-12-24 · 超过21用户采纳过TA的回答
知道答主
回答量:61
采纳率:0%
帮助的人:56.9万
展开全部

extjs官方文档显示用法如下

params中的参数名称不用加引号

追问
这个我都试过了的,后台有时可以获取到值,有时获取不到,令人想不通啊j!!!
追答
那你把url改为绝对路径试试,也可加断点跟踪一下
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友303bb38
2012-12-26 · TA获得超过411个赞
知道小有建树答主
回答量:408
采纳率:0%
帮助的人:298万
展开全部
断点调试一下,看在进入ACTION之前,参数的值是否正确,可以用FIREFOX的FIREBUG调试。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式