用javascript 创建easyui datagrid 后台代码怎么写?
这是小弟写的代码但是我想用这种方式写求用红笔标出的.方法代码(ps:我也知道它是个json对象,或者是返回的json方法,但是我不知道该怎么写)求代码这是我后台源码...
这是小弟写的代码
但是我想用这种方式写
求用红笔标出的.方法代码(ps:我也知道它是个json对象,或者是返回的json方法,但是我不知道该怎么写)
求代码
这是我后台源码 展开
但是我想用这种方式写
求用红笔标出的.方法代码(ps:我也知道它是个json对象,或者是返回的json方法,但是我不知道该怎么写)
求代码
这是我后台源码 展开
1个回答
展开全部
后台返回 datagrid_data.json ;
给个spring mvc 的例子供参考:
package zjgs.eai.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import zjgs.comm.PageForDataGrid;
import zjgs.eai.command.QuerySpErrorCommand;
import zjgs.eai.service.EaiService;
import javax.servlet.http.HttpServletRequest;
@Controller
public class QuerySpErrorController {
protected final Log logger = LogFactory.getLog(getClass());
@Autowired
private EaiService eaiService;
public EaiService getEaiService() {
return eaiService;
}
//初始化 JSP 页面
@RequestMapping(value = "/eai/querySpError.htm", method = RequestMethod.GET)
public String initPage(HttpServletRequest request) {
request.setAttribute("querySpErrorCommand", new QuerySpErrorCommand());
return "eai/querySpError";
}
//查询---返回对应的信息
@RequestMapping(value = "/eai/querySpSpxxByNsrsbh.json", method = RequestMethod.POST)
public String getDataSetSpxx(@ModelAttribute("pojo") QuerySpErrorCommand querySpErrorCommand, ModelMap modelMap) {
PageForDataGrid pageForDataGrid = new PageForDataGrid(
this.getEaiService().getSpxxByXtsphm(querySpErrorCommand.getXtsphm()),
1,
100,
modelMap
);
pageForDataGrid.setDataGrid();
return "querySpSpxxByXtsphm.json";
}
//查询---返回数据逻辑错误的日志信息
@RequestMapping(value = "/eai/querySpError.json", method = RequestMethod.POST)
public String getDataSetErrorLog(@ModelAttribute("pojo") QuerySpErrorCommand querySpErrorCommand, ModelMap modelMap) {
PageForDataGrid pageForDataGrid = new PageForDataGrid(
this.getEaiService().getErrorLogByXtsphm(querySpErrorCommand.getXtsphm()),
1,
100,
modelMap
);
pageForDataGrid.setDataGrid();
return "querySpError.json";
}
}
给个spring mvc 的例子供参考:
package zjgs.eai.controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import zjgs.comm.PageForDataGrid;
import zjgs.eai.command.QuerySpErrorCommand;
import zjgs.eai.service.EaiService;
import javax.servlet.http.HttpServletRequest;
@Controller
public class QuerySpErrorController {
protected final Log logger = LogFactory.getLog(getClass());
@Autowired
private EaiService eaiService;
public EaiService getEaiService() {
return eaiService;
}
//初始化 JSP 页面
@RequestMapping(value = "/eai/querySpError.htm", method = RequestMethod.GET)
public String initPage(HttpServletRequest request) {
request.setAttribute("querySpErrorCommand", new QuerySpErrorCommand());
return "eai/querySpError";
}
//查询---返回对应的信息
@RequestMapping(value = "/eai/querySpSpxxByNsrsbh.json", method = RequestMethod.POST)
public String getDataSetSpxx(@ModelAttribute("pojo") QuerySpErrorCommand querySpErrorCommand, ModelMap modelMap) {
PageForDataGrid pageForDataGrid = new PageForDataGrid(
this.getEaiService().getSpxxByXtsphm(querySpErrorCommand.getXtsphm()),
1,
100,
modelMap
);
pageForDataGrid.setDataGrid();
return "querySpSpxxByXtsphm.json";
}
//查询---返回数据逻辑错误的日志信息
@RequestMapping(value = "/eai/querySpError.json", method = RequestMethod.POST)
public String getDataSetErrorLog(@ModelAttribute("pojo") QuerySpErrorCommand querySpErrorCommand, ModelMap modelMap) {
PageForDataGrid pageForDataGrid = new PageForDataGrid(
this.getEaiService().getErrorLogByXtsphm(querySpErrorCommand.getXtsphm()),
1,
100,
modelMap
);
pageForDataGrid.setDataGrid();
return "querySpError.json";
}
}
追问
哥,这个例子不行,有别的吗,或者给我那个实例写个json方法
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询