java后台的方法在jquery中怎么通过url获取?(这个在js中获取)

/**
* 获取文件总数 <br>
* url:/service/total/getDocCount<br>
* params:<br>
* (可选)1.groupId :所属目录id<br>
* (可选)2.title : 文档或目录名字<br>
* (可选)3.authorId : 作者帐号<br>
* 创建时间段<br>
* (可选)4.statrTime : 开始时间<br>
* (可选)5.endTime :结束时间<br>
*/
public Results handleGetDocCount(HttpServletRequest request,
HttpServletResponse response) throws SQLException0{
Results result = new Results();
if (this.owner == null) {
this.owner = OrgHelper.getOwner(request);
}

String cond = getDocCond(request);

String op = request.getParameter("op");

// 只显示属于当前企业的文档
cond += " and g.owner_id = " + owner.getOwnerId();

// 修改,新增文档是需要检验同目录下是否存在同名目录
if (op != null && !"".equals(op.trim()) && op.equals("checkSameName")) {
String newName = request.getParameter("newName");
long docId = Util.strTolong(request.getParameter("docId"));
cond += " and title = '" + newName + "' and doc_id <>" + docId;
}

OrgDoc orgDoc = new OrgDoc(qr, owner);
int totalNum = 0;
totalNum = orgDoc.getDocCount(cond);
result.put(Constants.RESULT, totalNum);
return result;
}
/**
* 获取文件总数
*/
function getDocTotal(prentId,data){
var url = "/service/total/getDocCount";
$.getDS(url,function(){
。。。。。。。。里面怎么写????
});

}

如果你用jquery,那么就只能通过ajax的方式 来获取,前后台代码要配合好。

还是用dwr吧 ,js可以直接调用后台java方法获取返回值
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-08-11
如果是在网页中调用的话,就是写在<head></head>中
<head>
<script type="text/javescript" href="这里是你的js存放路径.js"/>
</head>
第2个回答  2010-08-11
你是想用js调用jsp后台吧?

ajax
第3个回答  2012-04-11
我试试看~
相似回答
大家正在搜