• 大小: 733KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-03
  • 语言: Java
  • 标签: javaweb  

资源简介

使用websocket+mysql+java8+Tomcat8技术,管理端动态添加数据到数据库,用户端实时刷新新添加的数据。

资源截图

代码片段和文件信息

package fun;

import model.UserBean;

import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

/**
 * Created by 759517209@qq.com on 2017/5/9.
 * 查询数据库
 */
public class Client {
    public java.util.List list (){
        String sql=“select * from users“;
        DB db=new DB();
        try{
            Statement stmt=db.con.createStatement();
            ResultSet rs=stmt.executeQuery(sql);
            //创建列表
            java.util.List lists = new ArrayList();
            while(rs.next()){
                UserBean user=new UserBean();
                user.setId(rs.getInt(“id“));
                user.setName(rs.getString(“name“));
                // 将user添加到List集合中
                lists.add(user);
            }
            return lists;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }finally {
            db.close();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        916  2018-12-19 10:28  websocketDemo-master\.classpath

     文件        495  2017-05-11 18:59  websocketDemo-master\.idea\artifacts\demo2_war_exploded.xml

     文件        147  2017-05-11 18:59  websocketDemo-master\.idea\libraries\goeasy_sdk_0_3_5.xml

     文件        220  2017-05-11 18:59  websocketDemo-master\.idea\libraries\websocket_api.xml

     文件        273  2017-05-11 18:59  websocketDemo-master\.idea\misc.xml

     文件        250  2017-05-11 18:59  websocketDemo-master\.idea\modules.xml

     文件       8792  2017-05-11 18:59  websocketDemo-master\.idea\uiDesigner.xml

     文件      57432  2017-05-11 18:59  websocketDemo-master\.idea\workspace.xml

     文件        920  2018-12-19 10:46  websocketDemo-master\.project

     文件         57  2018-12-19 09:47  websocketDemo-master\.settings\org.eclipse.core.resources.prefs

     文件        364  2018-12-19 09:48  websocketDemo-master\.settings\org.eclipse.jdt.core.prefs

     文件        512  2018-12-19 09:48  websocketDemo-master\.settings\org.eclipse.wst.common.component

     文件        259  2018-12-19 09:48  websocketDemo-master\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件       1758  2018-12-19 10:28  websocketDemo-master\build\classes\fun\Client.class

     文件       1110  2018-12-19 10:47  websocketDemo-master\build\classes\fun\DB.class

     文件       4547  2018-12-19 10:48  websocketDemo-master\build\classes\fun\ManagerServlet.class

     文件        704  2018-12-19 10:28  websocketDemo-master\build\classes\model\UserBean.class

     文件       1060  2017-05-11 18:59  websocketDemo-master\demo2.iml

     文件        442  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\index.jsp

     文件        588  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\manager.jsp

     文件       2404  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\user.jsp

     文件       1784  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\WEB-INF\classes\fun\Client.class

     文件       1118  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\WEB-INF\classes\fun\DB.class

     文件       4566  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\WEB-INF\classes\fun\ManagerServlet.class

     文件        704  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\WEB-INF\classes\model\UserBean.class

     文件        594  2017-05-11 18:59  websocketDemo-master\out\artifacts\demo2_war_exploded\WEB-INF\web.xml

     文件       1784  2017-05-11 18:59  websocketDemo-master\out\production\demo2\fun\Client.class

     文件       1118  2017-05-11 18:59  websocketDemo-master\out\production\demo2\fun\DB.class

     文件       4566  2017-05-11 18:59  websocketDemo-master\out\production\demo2\fun\ManagerServlet.class

     文件        704  2017-05-11 18:59  websocketDemo-master\out\production\demo2\model\UserBean.class

............此处省略50个文件信息

评论

共有 条评论