extjs分页显示时只有表没有数据
我是从servlet获取数据,Show.java代码:publicclassShowextendsHttpServlet{privatestaticfinallongse...
我是从servlet获取数据,Show.java代码:
public class Show extends HttpServlet {
private static final long serialVersionUID = 1L;
public Show() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setHeader("content-type", "text/html; charset=UTF-8") ;
PrintWriter out = response.getWriter();
String _start = request.getParameter("start");
String _limit = request.getParameter("limit");
int start = Integer.parseInt(_start);
int limit = Integer.parseInt(_limit);
/* User stu=null;
UserDAO dao=new UserDAOimpl();//数据库操作方法集你需要自己完成编码。
List<User> list=dao.show();
int count=list.size();
out.print("{totalCount:"+count+",data:[");
for(int i=0;i<limit;i++){
stu=(User)list.get(i);
out.print("{userID:'"+stu.getuserID()+"',userName:'"+stu.getUserName()+
"',mobile:'"+stu.getmobile()+"',email:'"+stu.getemail()+"',nickname:'"+stu.getnickname()+"',region:'"+stu.getregion()+
"',birthday:'"+stu.getbirthday()+"',telephone:'"+stu.gettelephone()+"',address:'"+stu.getaddress()+"',postcode:'"+stu.getpostcode()+
"',signature:'"+stu.getsignature()+"',imageURL:'"+stu.getimageURL()+"',level:'"+stu.getLevel()+"'");
if(i==limit-1){
out.print("}");
}
else{
out.print("},");
}
}
out.print("]}");*/
out.print("{totalCount:2,data:[{userID:1,userName:'1',mobile:'1',email:'1',nickname:'1',region:'1',birthday:'2000-02-02',telephone:'1',address:'1',postcode:'1',signature:'1',imageURL:'1',level:'1'}," +
"{userID:2,userName:'2',mobile:'2',email:'2',nickname:'2',region:'2',birthday:'2000-01-01',telephone:'2',address:'2',postcode:'2',signature:'2',imageURL:'2',level:'2'}"+
// 这是便于观察的原始句式。
"]}") ;
out.flush();
out.close();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request,response);
}
} 展开
public class Show extends HttpServlet {
private static final long serialVersionUID = 1L;
public Show() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setHeader("content-type", "text/html; charset=UTF-8") ;
PrintWriter out = response.getWriter();
String _start = request.getParameter("start");
String _limit = request.getParameter("limit");
int start = Integer.parseInt(_start);
int limit = Integer.parseInt(_limit);
/* User stu=null;
UserDAO dao=new UserDAOimpl();//数据库操作方法集你需要自己完成编码。
List<User> list=dao.show();
int count=list.size();
out.print("{totalCount:"+count+",data:[");
for(int i=0;i<limit;i++){
stu=(User)list.get(i);
out.print("{userID:'"+stu.getuserID()+"',userName:'"+stu.getUserName()+
"',mobile:'"+stu.getmobile()+"',email:'"+stu.getemail()+"',nickname:'"+stu.getnickname()+"',region:'"+stu.getregion()+
"',birthday:'"+stu.getbirthday()+"',telephone:'"+stu.gettelephone()+"',address:'"+stu.getaddress()+"',postcode:'"+stu.getpostcode()+
"',signature:'"+stu.getsignature()+"',imageURL:'"+stu.getimageURL()+"',level:'"+stu.getLevel()+"'");
if(i==limit-1){
out.print("}");
}
else{
out.print("},");
}
}
out.print("]}");*/
out.print("{totalCount:2,data:[{userID:1,userName:'1',mobile:'1',email:'1',nickname:'1',region:'1',birthday:'2000-02-02',telephone:'1',address:'1',postcode:'1',signature:'1',imageURL:'1',level:'1'}," +
"{userID:2,userName:'2',mobile:'2',email:'2',nickname:'2',region:'2',birthday:'2000-01-01',telephone:'2',address:'2',postcode:'2',signature:'2',imageURL:'2',level:'2'}"+
// 这是便于观察的原始句式。
"]}") ;
out.flush();
out.close();
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request,response);
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询