zoukankan      html  css  js  c++  java
  • 数据表格

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>数据表格</title>
    
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="js/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="js/themes/icon.css">
    <script type="text/javascript" src="js/jquery.easyui.min.js"></script>
    
    <script type="text/javascript" src="js/locale/easyui-lang-zh_CN.js"></script>
    
    <script>
    $(function(){
        
        
    });
    
    </script>
    
    </head>
    <body>
    
    <table id="mydatagrid" class="easyui-datagrid" data-options="singleSelect:false,collapsible:true,url:'MembersList?parentid=0',method:'get'"
    style="100%;height:200px" title="地区列表"
    >
    <thead>
    <tr>
    <th data-options="field:'id',100">ID</th>
    <th data-options="field:'parentId',100">父ID</th>
    <th data-options="field:'name',100">地区名</th>
    <th data-options="field:'postCode',100">邮编</th>
    </tr>
    </thead>
    </table>
    
    </body>
    </html>
    package com.hanqi;
    
    import java.io.IOException;
    import java.util.ArrayList;
    
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import com.hanqi.dao.Members;
    import com.hanqi.dao.MembersDAL;
    import com.alibaba.fastjson.*;
    
    /**
     * Servlet implementation class JsonMembers
     */
    @WebServlet("/MembersList")
    public class MembersList extends HttpServlet {
        private static final long serialVersionUID = 1L;
           
        /**
         * @see HttpServlet#HttpServlet()
         */
        public MembersList() {
            super();
            // TODO Auto-generated constructor stub
        }
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            
            request.setCharacterEncoding("UTF-8");
            
            response.setContentType("text/html; charset=UTF-8");
            
            response.setCharacterEncoding("UTF-8");
            
            String rtn = "";
            
            String pid = request.getParameter("parentid");
            
            if(pid == null || pid.trim().length()==0)
            {
                pid = "-1";
            }
            
            int iPid = Integer.parseInt(pid);
            
            MembersDAL md = new MembersDAL();
            
            ArrayList<Members> al;
            
            try 
            {
                al = md.getList(iPid);
                
                if(al != null)
                {
                    rtn = "{"total":20,"rows":" + JSON.toJSONString(al) + "}";
                }
        
            } 
            catch (Exception e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            
            
            response.getWriter().print(rtn);
        
        }
    
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
         */
        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
            doGet(request, response);
        }
    
    }
  • 相关阅读:
    2019 icpc南昌全国邀请赛-网络选拔赛J题 树链剖分+离线询问
    Android小项目之十二 设置中心的界面
    【Mood-5】14条建议,使你的IT职业生涯更上一层楼
    【Android 界面效果15】Android UI 之一步步教你自定义控件(自定义属性、合理设计onMeasure、合理设计onDraw等)
    单线程模型中Message、Handler、Message Queue、Looper之间的关系
    140个google面试题
    Android小项目之十一 应用程序的主界面
    Android小项目之十 应用程序更新的签名问题
    Android小项目之九 两种上下文的区别
    Android小项目之八 界面细节
  • 原文地址:https://www.cnblogs.com/zxw0004/p/5087365.html
Copyright © 2011-2022 走看看