opurl = synInfo.action?proId=1&status="+status;
$.ajax({
type: "GET",
//async:'false',
contentType: "application/json; charset=utf-8",
url: opurl,
dataType:'jsonp',
jsonp:'jsoncallback',
//data: {"objId":objId,"sysName":sysName,"title":<%%>,"urlAddress":urlAddress,"objType":objType,"userEname":who,"jsoncallback":""},
success: function(data){
var flag = data.flag;
var msg = data.msg;
if(flag == 'T'){
alert("已经认领成功!");
}else{
alert("认领失败");
}
window.location.href="/aa.jsp";
},
error:function(XMLHttpRequest, textStatus, errorThrown){
alert(errorThrown);
}
});
public String jsonAttachList()
throws IOException
{
String jsoncallback = Struts2Utils.getRequest().getParameter("jsoncallback");
Struts2Utils.getResponse().setContentType("application/html;charset=UTF-8");
JSONObject jobj = new JSONObject();
String jb = StrUtil.doNull(jsoncallback);
String oi = StrUtil.doNull(this.objId);
String ot = StrUtil.doNull(this.objType);
if ((StrUtil.isEmptyWithTrim(oi)) || (StrUtil.isEmptyWithTrim(ot))) {
jobj.put("flag", "false");
jobj.put("msg", "缺少必要的参数!!");
if (StrUtil.isEmptyWithTrim(jb))
Struts2Utils.getResponse().getWriter().print(jobj.toString());
else {
Struts2Utils.getResponse().getWriter().print(jb + "(" + jobj.toString() + ")");
}
return null;
}
try {
List attachs = this.attachmentStoreManager.getAttachmentsByObjIT(oi, ot);
JSONArray jarr = new JSONArray();
for (Iterator iter = attachs.iterator(); iter.hasNext(); ) {
AttachmentStore atta = (AttachmentStore)iter.next();
AttaVO vo = copyAttaProp(atta);
jarr.add(JSONObject.fromObject(vo));
}
jobj.put("total", Integer.valueOf(jarr.size()));
jobj.put("flag", "true");
jobj.put("msg", "恭喜,数据查询成功!!");
jobj.put("rows", JSONArray.toArray(jarr));
logger.info("pic list get success!");
} catch (AttachmentStoreException e) {
jobj.put("flag", "false");
jobj.put("msg", "抱歉,附件查询异常!!");
logger.error(e);
} catch (AttachmentException e) {
jobj.put("flag", "false");
jobj.put("msg", "抱歉,附件查询异常!!");
logger.error(e);
}
if (StrUtil.isEmptyWithTrim(jb))
Struts2Utils.getResponse().getWriter().print(jobj.toString());
else {
Struts2Utils.getResponse().getWriter().print(jb + "(" + jobj.toString() + ")");
}
return null;
}
$.ajax({
type: "GET",
//async:'false',
contentType: "application/json; charset=utf-8",
url: opurl,
dataType:'jsonp',
jsonp:'jsoncallback',
//data: {"objId":objId,"sysName":sysName,"title":<%%>,"urlAddress":urlAddress,"objType":objType,"userEname":who,"jsoncallback":""},
success: function(data){
var flag = data.flag;
var msg = data.msg;
if(flag == 'T'){
alert("已经认领成功!");
}else{
alert("认领失败");
}
window.location.href="/aa.jsp";
},
error:function(XMLHttpRequest, textStatus, errorThrown){
alert(errorThrown);
}
});
public String jsonAttachList()
throws IOException
{
String jsoncallback = Struts2Utils.getRequest().getParameter("jsoncallback");
Struts2Utils.getResponse().setContentType("application/html;charset=UTF-8");
JSONObject jobj = new JSONObject();
String jb = StrUtil.doNull(jsoncallback);
String oi = StrUtil.doNull(this.objId);
String ot = StrUtil.doNull(this.objType);
if ((StrUtil.isEmptyWithTrim(oi)) || (StrUtil.isEmptyWithTrim(ot))) {
jobj.put("flag", "false");
jobj.put("msg", "缺少必要的参数!!");
if (StrUtil.isEmptyWithTrim(jb))
Struts2Utils.getResponse().getWriter().print(jobj.toString());
else {
Struts2Utils.getResponse().getWriter().print(jb + "(" + jobj.toString() + ")");
}
return null;
}
try {
List attachs = this.attachmentStoreManager.getAttachmentsByObjIT(oi, ot);
JSONArray jarr = new JSONArray();
for (Iterator iter = attachs.iterator(); iter.hasNext(); ) {
AttachmentStore atta = (AttachmentStore)iter.next();
AttaVO vo = copyAttaProp(atta);
jarr.add(JSONObject.fromObject(vo));
}
jobj.put("total", Integer.valueOf(jarr.size()));
jobj.put("flag", "true");
jobj.put("msg", "恭喜,数据查询成功!!");
jobj.put("rows", JSONArray.toArray(jarr));
logger.info("pic list get success!");
} catch (AttachmentStoreException e) {
jobj.put("flag", "false");
jobj.put("msg", "抱歉,附件查询异常!!");
logger.error(e);
} catch (AttachmentException e) {
jobj.put("flag", "false");
jobj.put("msg", "抱歉,附件查询异常!!");
logger.error(e);
}
if (StrUtil.isEmptyWithTrim(jb))
Struts2Utils.getResponse().getWriter().print(jobj.toString());
else {
Struts2Utils.getResponse().getWriter().print(jb + "(" + jobj.toString() + ")");
}
return null;
}