資源簡(jiǎn)介
使用websocket+mysql+java8+Tomcat8技術(shù),管理端動(dòng)態(tài)添加數(shù)據(jù)到數(shù)據(jù)庫,用戶端實(shí)時(shí)刷新新添加的數(shù)據(jù)。

代碼片段和文件信息
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.
?*?查詢數(shù)據(jù)庫
?*/
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);
????????????//創(chuàng)建列表
????????????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();
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????916??2018-12-19?10:28??websocketDemo-master\.classpath
?????文件????????495??2017-05-11?18:59??websocketDemo-master\.idea\artifacts\demo2_war_exploded.xm
?????文件????????147??2017-05-11?18:59??websocketDemo-master\.idea\libraries\goeasy_sdk_0_3_5.xm
?????文件????????220??2017-05-11?18:59??websocketDemo-master\.idea\libraries\websocket_api.xm
?????文件????????273??2017-05-11?18:59??websocketDemo-master\.idea\misc.xm
?????文件????????250??2017-05-11?18:59??websocketDemo-master\.idea\modules.xm
?????文件???????8792??2017-05-11?18:59??websocketDemo-master\.idea\uiDesigner.xm
?????文件??????57432??2017-05-11?18:59??websocketDemo-master\.idea\workspace.xm
?????文件????????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.xm
?????文件???????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.xm
?????文件???????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個(gè)文件信息
評(píng)論
共有 條評(píng)論