——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Tomcat≥8
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的JSP+Servlet应急救援管理系统(java+servlet+jsp+mysql)
首页:http://localhost:8080/login.jsp
管理员(allusers表): admin 123456
应急人员(yingjirenyuan表): emp1 123456 emp2 123456
用户(yonghuxinxi表): user1 123456 user2 123456
主流程: 用户: 紧急呼救-紧急呼救
管理员: 紧急呼救查询-审核通过 指挥调度管理-指挥调度添加
应急人员: 现场情况管理-现场情况添加
管理员: 应急评估管理-应急评估添加
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 public class PageManager { private PageManager () { } public static final int DEFAULTPAGESIZE = 20 ; public static final int segment = 10 ; protected int currentPage; protected int pageSize; protected long pageNumber; protected long count; protected Collection collection;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 if (str.equals("null" )) str = "" ; list2.add(str); } else list2.add(rs.getString(j)); } list.add(list2); } rs.close(); st.close(); } catch (SQLException e) { e.printStackTrace(); } return list; } public void close () {} public List<HashMap> select (String sql, int pageno, int rowsize) { List<HashMap> list = new ArrayList<HashMap>(); List<HashMap> mlist = new ArrayList<HashMap>(); try { list = this .select(sql); int min = (pageno - 1 ) * rowsize; int max = pageno * rowsize; for (int i = 0 ; i < list.size(); i++) { if (!(i < min || i > (max - 1 ))) { mlist.add(list.get(i)); } } } catch (RuntimeException re) { re.printStackTrace(); throw re; } return mlist; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 buf.append("第").append(this.currentPage).append("/").append( this.pageNumber).append("页"); buf.append(" "); if (this.currentPage == 1) buf.append("首页"); else buf.append("<a href ='").append(this.path).append("¤tPage=1") .append(parameter) .append("' class ='ls' > ").append("首页") .append("</a > "); // ////////////////////////#1157B7 buf.append(" "); if (this.currentPage > 1) { buf.append("<a href ='").append(this.path).append("¤tPage=") .append(currentPage - 1).append(parameter).append( "' class ='ls' > ").append("上页") .append("</a > "); } else { buf.append("上页"); } buf.append(" "); int currentSegment = this.currentPage % segment == 0 ? this.currentPage / segment : this.currentPage / segment + 1; /*for (int i = 1; i <= this.pageNumber; i++) { if (this.currentPage == i) buf.append("<font color ='red' > ").append(i).append("</font > "); else buf.append("<a href ='").append(this.path).append( "¤tPage=").append(i).append(parameter).append( "' class ='ls' > [").append(i).append( "]</a > "); }*/ buf.append(" "); if (this.currentPage < this.pageNumber) { buf.append("<a href ='").append(this.path).append("¤tPage=")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 if (request.getParameter(vstr) != null && !"" .equals(request.getParameter(vstr)) && request.getParameter("dk-" + rsmd.getColumnName(j) + "-value" ) != null ) { String dkv = request.getParameter(vstr); String dknamevalue = request.getParameter("dk-" + rsmd.getColumnName(j) + "-value" ); vstr += " - " + dknamevalue + ":" + dkv; System.out.println(vstr); } value += vstr + " ~ " ; } if (value == null ) value = "" ; if (value.equals("null" )) value = "" ; if (value.length() > 0 ) value = value.substring(0 , value.length() - 3 ); if (rsmd.getColumnTypeName(j).equals("int" )) { sql += rsmd.getColumnName(j) + "=" + value + "," ; } else { sql += rsmd.getColumnName(j) + "='" + value + "'," ; } } else { if (extmap.get(rsmd.getColumnName(j)) != null ) { if (rsmd.getColumnTypeName(j).equals("int" )) { sql += rsmd.getColumnName(j) + "=" + extmap.get(rsmd.getColumnName(j)) + "," ; } else { sql += rsmd.getColumnName(j) + "='" + extmap.get(rsmd.getColumnName(j)) + "'," ; } } } } sql = sql.substring(0 , sql.length() - 1 ); sql += " where id=" + request.getParameter("id" ); System.out.println(sql); Statement st1 = conn.createStatement(); st1.execute(sql); st1.close(); rs.close(); st.close(); } catch (SQLException e) { e.printStackTrace(); } String str = "" ; if (!reflush) str += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" ; str += "<script language=javascript>\n" ; if (alert) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 } public synchronized static String ensubStr (Object source, int length) { String msource = Info.filterStrIgnoreCase(source.toString(), "<" , ">" ); if (msource.length() > length) { msource = msource.substring(0 , length) + "..." ; } return msource; } public static String getDateStr () { String dateString = "" ; try { java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss" ); java.util.Date currentTime_1 = new java.util.Date(); dateString = formatter.format(currentTime_1); } catch (Exception e) { } return dateString; } public static String getUTFStr (String str) { if (str == null ) { return "" ; } try { str = new String(str.getBytes("UTF-8" ), "UTF-8" ); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } public static String getGBKStr (String str) throws UnsupportedEncodingException { if (str == null ) { return "" ; } return new String(str.getBytes("UTF-8" ), "UTF-8" ); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 } return dateString; } public static String getUTFStr (String str) { if (str == null ) { return "" ; } try { str = new String(str.getBytes("UTF-8" ), "UTF-8" ); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return str; } public static String getGBKStr (String str) throws UnsupportedEncodingException { if (str == null ) { return "" ; } return new String(str.getBytes("UTF-8" ), "UTF-8" ); } public static String getGB2312Str (String str) throws UnsupportedEncodingException { if (str == null ) { return "" ; } return new String(str.getBytes("UTF-8" ), "UTF-8" ); } public static String getDay (String date, int day) { String b = date.substring(0 , 10 ); String c = b.substring(0 , 4 ); String d = b.substring(5 , 7 ); String f = b.substring(8 , 10 ); String aa = c + "/" + d + "/" + f; String a = "" ; DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); GregorianCalendar grc = new GregorianCalendar(); grc.setTime(new Date(aa));
——————————PayStart——————————
项目链接: https://javayms.github.io?id=482123562309201fj https://javayms.pages.dev?id=482123562309201fj