正在加载图片...
public message getMsg (int id)t openD String sql 根据I查询一条记录 try rs stat executeQuery(sgl) while(rs next() new message(rs getInt(1) rs getstring(2),rs getstring(3),rs getstring (4),rs getstring(5),rs getstring(6))i y catch (SQLException e) t // TODO Auto-generated catch block e printstackTrace()i F finally( s closed stat close(i y catch (SQLException e) t // TODO Auto-generated catch block printstackTrace( closed ()i return ms 4.处理留言的添加、删除和修改 在自定义包 servlet中建立文件名为 MsgProcess.java的 servlet,其 dopost方法定义如下 补全阴影部分 String action request getParameter("action")i String innerID request getParameter("id")i int id =-1 if(innerID ! null & innerIDlength()!= 0) Ld integer lueof(innerID) String name request getParameter("name") ate da new Date()i string[]tmp=da.七ea1eS七王主n9().sp1it("") String date tmp [O] string time tmp[1]public message getMsg(int id){ openDB(); String sql = try { rs = stat.executeQuery(sql); while(rs.next()){ msg = new message(rs.getInt(1), rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs .getString(6)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ try { rs.close(); stat.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } closeDB(); } return msg; } } 根据 ID 查询一条记录 4. 处理留言的添加、删除和修改 在自定义包servlet中建立文件名为MsgProcess.java的servlet,其dopost方法定义如下 补全阴影部分 String action = request.getParameter("action"); String innerID = request.getParameter("id"); int id = -1; if(innerID != null && innerID.length() != 0) id = Integer.valueOf(innerID); String name = request.getParameter("name"); Date da = new Date(); String[] tmp = da.toLocaleString().split(" "); String date = tmp[0]; String time = tmp[1];
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有