标签:result str print out png 问题 delete 类型 sed
1.任务安排,画表格展示
计划时间 | 计划任务 | 计划是否完成 |
3.22-3.29 | 管理员的增删改查 | 是 |
3.29-4.5 | 编写活动模块 | 是 |
4.16-4.22 | 完善活动的增删改查 | 是 |
4.23-4.30 | 分类管理员与用户界面,交接前端 |
2.本周完成内容
完善了活动的增删改查
3.本周实现代码
主要是修改了event的servlet层代码,上周的代码不能正确调用,这周进行了完善
1 else if(action.equals("del")) 2 { 3 int id=Integer.parseInt(request.getParameter("id")); 4 String sql="delete from pt_eventthreads where EventID=?"; 5 int res=0; 6 try { 7 res = dbc.doUpdate(sql,new Object[]{id}); 8 } catch (SQLException e) { 9 e.printStackTrace(); 10 } 11 System.out.println(id); 12 if(res>0) 13 { 14 request.getRequestDispatcher("event?action=query").forward(request, response); 15 }else 16 { 17 PrintWriter out=response.getWriter(); 18 out.print("删除失败"); 19 out.close(); 20 } 21 }else if(action.equals("add")) 22 { 23 String EventName=request.getParameter("EventName"); 24 String EventType=request.getParameter("EventType"); 25 String EventInitiator=request.getParameter("EventInitiator"); 26 int UserID=Integer.parseInt(request.getParameter("UserID")); 27 String Body=request.getParameter("Body"); 28 String StartTime=request.getParameter("StartTime"); 29 String EndTime=request.getParameter("EndTime"); 30 String SignEndTime=request.getParameter("SignEndTime"); 31 String DateCreated=request.getParameter("DateCreated"); 32 String Location=request.getParameter("Location"); 33 int LimitCount=Integer.parseInt(request.getParameter("LimitCount")); 34 35 String sql="insert into pt_eventthreads(EventName,EventType,EventInitiator,UserID,Body,StartTime,EndTime,SignEndTime,DateCreated,Location,LimitCount) values(?,?,?,?,?,?,?,?,?,?,?)"; 36 int res=0; 37 try { 38 res = dbc.doUpdate(sql,new Object[]{EventName,EventType,EventInitiator,UserID,Body,StartTime,EndTime,SignEndTime,DateCreated,Location,LimitCount}); 39 } catch (SQLException e) { 40 e.printStackTrace(); 41 } 42 if(res>0) 43 { 44 request.getRequestDispatcher("event?action=query").forward(request, response); 45 }else 46 { 47 PrintWriter out=response.getWriter(); 48 out.print("添加失败"); 49 out.close(); 50 } 51 52 }else if(action.equals("edit")) 53 { 54 int EventID=Integer.parseInt(request.getParameter("id")); 55 String sql="select *from pt_eventthreads where EventID=?"; 56 EventThreads et = null; 57 try { 58 ResultSet rs=dbc.doQueryRS(sql,new Object[]{EventID}); 59 if(rs.next()) 60 { 61 et = new EventThreads(); 62 63 et.setUserID(rs.getInt("UserID")); 64 et.setEventID(rs.getInt("EventID")); 65 et.setEventName(rs.getString("EventName")); 66 et.setEventType(rs.getString("EventType")); 67 et.setEventInitiator(rs.getString("EventInitiator")); 68 et.setStartTime(rs.getString("StartTime")); 69 et.setEndTime(rs.getString("EndTime")); 70 et.setSignEndTime(rs.getString("SignEndTime")); 71 et.setDateCreated(rs.getString("DateCreated")); 72 et.setLocation(rs.getString("Location")); 73 et.setBody(rs.getString("Body")); 74 et.setHitTimes(rs.getInt("HitTimes")); 75 et.setLimitCount(rs.getInt("LimitCount")); 76 } 77 } catch (SQLException e) { 78 e.printStackTrace(); 79 } 80 HttpSession session=request.getSession(); 81 session.setAttribute("event", et); 82 request.getRequestDispatcher("edit_event.jsp").forward(request, response); 83 84 }else if(action.equals("update")) 85 { 86 int EventID=Integer.parseInt(request.getParameter("EventID")); 87 String EventName=request.getParameter("EventName"); 88 String EventType=request.getParameter("EventType"); 89 String EventInitiator=request.getParameter("EventInitiator"); 90 int UserID=Integer.parseInt(request.getParameter("UserID")); 91 String Body=request.getParameter("Body"); 92 String StartTime=request.getParameter("StartTime"); 93 String EndTime=request.getParameter("EndTime"); 94 String SignEndTime=request.getParameter("SignEndTime"); 95 String DateCreated=request.getParameter("DateCreated"); 96 String Location=request.getParameter("Location"); 97 int LimitCount=Integer.parseInt(request.getParameter("LimitCount")); 98 String sql="update pt_eventthreads set EventName=?,EventType=?,EventInitiator=?,UserID=?,StartTime=?,EndTime=?,SignEndTime=?,DateCreated=?,Location=?,Body=?,LimitCount=? where EventID=?"; 99 int res=0; 100 try { 101 res = dbc.doUpdate(sql,new Object[]{EventName,EventType,EventInitiator,UserID,StartTime,EndTime,SignEndTime,DateCreated,Location,Body,LimitCount,EventID}); 102 } catch (SQLException e) { 103 e.printStackTrace(); 104 } 105 if(res>0) 106 { 107 request.getRequestDispatcher("event?action=query").forward(request, response); 108 }else 109 { 110 PrintWriter out=response.getWriter(); 111 out.print("fail"); 112 out.close(); 113 } 114 }else 115 { 116 117 } 118 } 119 120 }
活动的增加和查询(面向管理员) 出现了点中文乱码问题,应该不难解决
活动的修改
活动的删除
主要是没有正确的调用给之前给EventID命名的名称,然后就是时间类型不好设置和调用,正在考虑怎么实现最好
活动的增删改查都写好了,但主要是面向管理员的,面向用户的准备下一周做出来,然后前端页面尽量花时间去做出来,
标签:result str print out png 问题 delete 类型 sed
原文地址:http://www.cnblogs.com/gxt-smart/p/6750186.html