每日打卡(二)
package service;import bean.Dbean;import dao.Dao;import java.sql.SQLException;import java.util.List;public class Service { Dao tDao=new Dao(); public boolean add(Dbean ten) throws SQLException, ClassNotFoundException { boolean f = false; if(!tDao.name(ten.getDate())) { tDao.add(ten); f=true; } return f; } public boolean del(String title) throws SQLException, ClassNotFoundException { tDao.delete(title); return true; } public Dbean getbytitle(String title) throws SQLException, ClassNotFoundException { return tDao.getbytitle(title); } public List<Dbean> list() throws SQLException, ClassNotFoundException { return tDao.list(); }} |
|
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
|
<html><head> <title>每日在线打卡</title></head><body><form method="post" action="AddServlet"> <table align="center" border="1" width="600"> <tr> <td>日期</td> <td> <input type="text" name="date" ><br> </td> </tr> <tr> <td>每日关键字</td> <td> <input type="text" name="zi" ><br> </td> </tr> <tr> <td>每日总结</td> <td> <input type="text" name="zong" ><br> </td> </tr> <tr> <td>坚持天数</td> <td> <input type="text" name="days" ><br> </td> </tr> <tr> <td>连续最长天数</td> <td> <input type="text" name="Mdays" ><br> </td> </tr> <tr align="center"> <td colspan="2"> <button>提交</button> </td> </tr> </table></form></body></html> |
|
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
52
53
54
55
|
<html><head> <title>浏览</title></head><body><h2 align="center" >操作成功</h2><br><table align="center" border="1"> <tr> <td align="center" width=10%>日期</td> <td align="center" width=10%>每日关键字</td> <td align="center" width=10%>每日总结</td> <td align="center" width=10%>坚持天数</td> <td align="center" width=10%>连续最长天数</td> </tr> <% Connection connection= DBUtil.getConnection(); PreparedStatement preparedStatement=null; ResultSet in=null; try{// 按照添加时间排序:: preparedStatement=connection.prepareStatement("select * from daka"); in = preparedStatement.executeQuery(); while(in.next()){ %> <tr> <td><%=in.getString(1)%></td> <td><%=in.getString(2)%></td> <td><%=in.getString(3)%></td> <td><%=in.getString(4)%></td> <td><%=in.getString(5)%></td> </tr> <% } } catch (SQLException e) { throw new RuntimeException(e); }finally { connection.close(); preparedStatement.close(); in.close(); } %> <p style="text-align:center;color: black; font-family: 宋体; font-size: 20px"> <br> <input type="button" value="返回菜单" onclick="location.href='index.jsp'" /> <br></table></body></html> |

浙公网安备 33010602011771号