url:"MyServlet",

        async:true,   //是否为异步请求

        cache:false,  //是否缓存结果

        type:"GET",

        dataType:"json",

        data :{

            "data" : initDate,

        },

        success : function(data){

            for(var i=0;i<=data.length;i++){

                $("#typeDefine").jqGrid('addRowData',i+1,data[i]);

            }

        }

    })

    switch(options.oper){

        case 'jqGridCre':jqgridCre(initDate,grid_selector);

            break;

        case 'jqGridFre':jqGridFre(initDate,grid_selector);

            break;

    }

    $('[id^=jqgh_typeDefine_]').css("height","20px");

}

function jqgridCre(initDate,grid_selector) {

    jQuery(grid_selector).jqGrid({

        colNames:['标识符','属性', '名称','传感器种类','单位/0态名称','高值/1态名称'],

        colModel:[

            {

                name:'id',

                index:'id',

                width: 100,

            },{

                name:'property',

                index:'property',

                width: 100,

            },{

                name:'name',

                index:'name',

                width: 100,

            },{

                name:'sensortype',

                index:'sensortype',

                width: 100,

            },{

                name:'unit',

                index:'unit',

                width: 100,

            },{

                name:'highvalue',

                index:'highvalue',

                width: 100,

            }

        ],

        sortname : "id",

        sortorder : "desc",

        viewrecords : true,

        shrinkToFit : true,

        width: 1645,

        height: 500,

        rowNum : 20,

        rowList : [ 10,15,30 ],

        datatype: 'text',

        pager: "#typeDefinePager",

        onSelectRow:function(rowid){

            grid_selectRow = $(grid_selector).jqGrid("getRowData",rowid);

        },

    });

}

})(jQuery);


### 3、servlet

package com.test.servlet;

import com.test.entity.MyEntity;

import com.test.service.MyService;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

public class MyServlet extends HttpServlet {

MyService service = new MyService();

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{

    response.setContentType("text/html");

    request.setCharacterEncoding("utf-8");

    response.setCharacterEncoding("utf-8");

}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{

    response.setContentType("text/html");

    request.setCharacterEncoding("utf-8");

    response.setCharacterEncoding("utf-8");

    String jqgridData = request.getParameter("data");

    MyEntity myEntity = new MyEntity();

    myEntity.setJqgridData(jqgridData);

    String str = service.getJqgridData(myEntity);

    response.getWriter().print(str);

}

}


### 4、service

package com.test.service;

import com.test.dao.MyDao;

import com.test.entity.MyEntity;

public class MyService {

MyDao myDao = new MyDao();

public String getJqgridData(MyEntity myEntity) {

    String jqgridData = myDao.selectJqgridData(myEntity);

    return jqgridData;

}

}


### 5、dao

package com.test.dao;

import com.test.entity.MyEntity;

import com.test.entity.SecondData;

import com.test.util.MySQLFactory;

import org.json.JSONArray;

import org.json.JSONException;

import org.json.JSONObject;

public class MyDao {

public String selectJqgridData(MyEntity myEntity) {

    String str = myEntity.getJqgridData();

    String data = "";

    try {

        JSONObject obj = new JSONObject(str);

        String oper = String.valueOf(obj.get("oper"));

        String fileds = String.valueOf(obj.get("fileds")).replace(""","")

                                                          .replace("[","")

                                                          .replace("]","");

        String table = String.valueOf(obj.get("table"));

        String sql = String.format(

                "select %s from %s ",fileds,table

        );

        System.out.println(sql);

        data = MySQLFactory.queryData(sql);

    } catch (JSONException e) {

        e.printStackTrace();

    }

    return data;

}

}


### 6、entity

package com.test.entity;

public class MyEntity {

private String jqgridData;

public MyEntity() {

}

public MyEntity(String jqgridData) {

    this.jqgridData = jqgridData;

}

public String getJqgridData() {

    return jqgridData;

}

public void setJqgridData(String jqgridData) {

    this.jqgridData = jqgridData;

}

}


### 7、连接池

package com.test.util;

import java.sql.*;

public class MySQLFactory {

static final String DRVIER = "com.mysql.jdbc.Driver";

static final String URL = "jdbc:mysql://localhost:3306/mysql";

static final String USERNAMR = "root";

static final String PASSWORD = "root";

private static Connection conn = null;

public static Connection getConnection(){

    try {

        Class.forName(DRVIER);

        conn = DriverManager.getConnection(URL, USERNAMR, PASSWORD);

        System.out.println("成功连接数据库");

Java核心架构进阶知识点

CodeChina开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频】

面试成功其实都是必然发生的事情,因为在此之前我做足了充分的准备工作,不单单是纯粹的刷题,更多的还会去刷一些Java核心架构进阶知识点,比如:JVM、高并发、多线程、缓存、Spring相关、分布式、微服务、RPC、网络、设计模式、MQ、Redis、MySQL、设计模式、负载均衡、算法、数据结构、kafka、ZK、集群等。而这些也全被整理浓缩到了一份pdf——《Java核心架构进阶知识点整理》,全部都是精华中的精华,本着共赢的心态,好东西自然也是要分享的

image

image

image

内容颇多,篇幅却有限,这就不在过多的介绍了,大家可根据以上截图自行脑补