一、‘我要投稿’功能
二、效果如下
三、建表
story
1 SET FOREIGN_KEY_CHECKS=0; 2 3 -- ---------------------------- 4 -- Table structure for `story` 5 -- ---------------------------- 6 DROP TABLE IF EXISTS `story`; 7 CREATE TABLE `story` ( 8 `id` int(11) NOT NULL AUTO_INCREMENT, 9 `ctitle` varchar(255) DEFAULT NULL, 10 `etitle` varchar(255) DEFAULT NULL, 11 `cabstract` varchar(255) DEFAULT NULL, 12 `eabstract` varchar(255) DEFAULT NULL, 13 `ckey` varchar(255) DEFAULT NULL, 14 `ekey` varchar(255) DEFAULT NULL, 15 `content` varchar(255) DEFAULT NULL, 16 `receiver` varchar(255) DEFAULT NULL, 17 `status` varchar(255) DEFAULT NULL, 18 `name` varchar(255) DEFAULT NULL, 19 `time` varchar(255) DEFAULT NULL, 20 PRIMARY KEY (`id`) 21 ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; 22 23 -- ---------------------------- 24 -- Records of story 25 -- ---------------------------- 26 INSERT INTO `story` VALUES ('1', '二', 'er', '二', 'e', '二', 'e', '人防', '格式审查中', '1', 'tgr', null); 27 INSERT INTO `story` VALUES ('2', '发的方法的', 'ewe', '胃肠道', 'der', '而非', 'ere', '染发热管', '稿件已退回', '1', 'tgr', '2021-09-28'); 28 INSERT INTO `story` VALUES ('3', '重复百度', 'dfd', '发热', 'sdwe', '单位房', 'ewe', '任务的繁荣', '审签同意', '1', 'tgr', null); 29 INSERT INTO `story` VALUES ('4', '辅导费', 'eer', '第三方', 'dfd', '热热放入提', 'er', '发热', '格式审查中', '1', 'tgr', null); 30 INSERT INTO `story` VALUES ('5', '尔夫人', 'ew', '饿', 'e', '人', 'r', '人人', '已签发', '1', 'tgr1', '2021-09-28'); 31 INSERT INTO `story` VALUES ('6', '发广告', 'g', '个', 'g', '该', 't', '通过', '格式审查中', '1', 'tgr1', null); 32 INSERT INTO `story` VALUES ('7', '今天投稿啦', 'jintiantougaola', '投稿啦摘要', 'tougaolazhaiyao', '投稿啦key', 'key', '今天我投稿了一篇文章哦', '审签同意', '1', 'tgr', null);
storysituation
1 SET FOREIGN_KEY_CHECKS=0; 2 3 -- ---------------------------- 4 -- Table structure for `storysituation` 5 -- ---------------------------- 6 DROP TABLE IF EXISTS `storysituation`; 7 CREATE TABLE `storysituation` ( 8 `id` int(11) NOT NULL AUTO_INCREMENT, 9 `ctitle` varchar(255) DEFAULT NULL, 10 `receiver` varchar(255) DEFAULT NULL, 11 `shenqianAgree` varchar(255) DEFAULT NULL, 12 `shenqianOpinion` varchar(255) DEFAULT NULL, 13 `chachongResult` varchar(255) DEFAULT NULL, 14 `name_one` varchar(255) DEFAULT NULL, 15 `name_one_agree` varchar(255) DEFAULT NULL, 16 `name_one_opinion` varchar(255) DEFAULT NULL, 17 `name_two` varchar(255) DEFAULT NULL, 18 `name_two_agree` varchar(255) DEFAULT NULL, 19 `name_two_opinion` varchar(255) DEFAULT NULL, 20 `name_three` varchar(255) DEFAULT NULL, 21 `name_three_agree` varchar(255) DEFAULT NULL, 22 `name_three_opinion` varchar(255) DEFAULT NULL, 23 `user_oppose_opinion` varchar(255) DEFAULT NULL, 24 PRIMARY KEY (`id`) 25 ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; 26 27 -- ---------------------------- 28 -- Records of storysituation 29 -- ---------------------------- 30 INSERT INTO `storysituation` VALUES ('1', '二', '格式审查中', null, null, null, null, null, null, null, null, null, null, null, null, null); 31 INSERT INTO `storysituation` VALUES ('2', '发的方法的', '稿件已退回', '同意', '同意', '合格', 'sgr', '同意', '(o´ω`o)و', 'sgr1', '同意', '同意', 'sgr2', '同意', '同意了', '~~不太好~~还行吧'); 32 INSERT INTO `storysituation` VALUES ('3', '重复百度', '审签同意', '同意', 'OK看看', null, null, null, null, null, null, null, null, null, null, null); 33 INSERT INTO `storysituation` VALUES ('4', '辅导费', '格式审查中', null, null, null, null, null, null, null, null, null, null, null, null, null); 34 INSERT INTO `storysituation` VALUES ('5', '尔夫人', '已签发', '同意', '同意啦', '合格', 'sgr', '同意', '同义', 'sgr4', '不同意', '不同意', 'sgr3', '同意', '同意', null); 35 INSERT INTO `storysituation` VALUES ('6', '发广告', '格式审查中', null, null, null, null, null, null, null, null, null, null, null, null, null); 36 INSERT INTO `storysituation` VALUES ('7', '今天投稿啦', '审签同意', '同意', 'wo tong yi o ', null, null, null, null, null, null, null, null, null, null, null);
四、代码如下
Contribute.jsp
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html> 4 <html> 5 <head> 6 <meta charset="UTF-8"> 7 <title>投稿人功能页</title> 8 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 9 <script src=".//layui/layui.all.js"></script> 10 <script src=".//layui/layui.js"></script> 11 <script type="text/javascript"> 12 //JavaScript代码区域 13 layui.use('element', function() { 14 var element = layui.element; 15 }); 16 </script> 17 </head> 18 <body class="layui-layout-body"> 19 20 <div class="layui-layout layui-layout-admin"> 21 <div class="layui-header"> 22 <div class="layui-logo"> 23 <% 24 String identity = (String) session.getAttribute("identity"); 25 out.print(identity); 26 %> 27 功能页欢迎 28 <% 29 String username = (String) session.getAttribute("username"); 30 out.print(username); 31 %> 32 </div> 33 </div> 34 35 <div class="layui-side layui-bg-black"> 36 <div class="layui-side-scroll"> 37 <!-- 左侧导航 --> 38 <ul class="layui-nav layui-nav-tree"> 39 <li class="layui-nav-item"><a href="Contribute_submit.jsp" 40 target="frame">我要投稿</a></li> 41 <li class="layui-nav-item"><a href="ContributeServlet?method=alter" 42 target="frame">修改稿件</a></li> 43 <li class="layui-nav-item"><a 44 href="ContributeServlet?method=withdraw" target="frame">退审意见</a></li> 45 <li class="layui-nav-item"><a 46 href="ContributeServlet?method=Check_The_Schedule" target="frame">查看进度</a></li> 47 <li class="layui-nav-item"><a 48 href="Contribute_alterpassword.jsp" target="frame">密码修改</a></li> 49 </ul> 50 </div> 51 </div> 52 <div class="layui-body"> 53 <!-- 内容主体区域 --> 54 <iframe name="frame" width="100%" height="100%" 55 style="border: 1px solid #CCC;"></iframe> 56 </div> 57 <div> 58 <div> 59 <input type="text" id="date" /> 60 </div> 61 </div> 62 </div> 63 64 </body> 65 </html>
Contribute_view_progress.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>查看进度</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <c:forEach items="${list}" var="story"> 15 <div class="layui-form-item"> 16 <label class="layui-form-label">中文标题</label> 17 <div class="layui-input-block"> 18 <input type="text" name="ctitle" required lay-verify="required" 19 placeholder="请输入中文标题" autocomplete="off" class="layui-input" 20 value="${story.ctitle}"> 21 </div> 22 <div class="layui-form-mid layui-word-aux">(限100字以内)</div> 23 </div> 24 <div class="layui-form-item"> 25 <label class="layui-form-label">进度</label> 26 <div class="layui-input-block"> 27 <input type="text" name="receiver" required lay-verify="required" 28 autocomplete="off" class="layui-input" value="${story.receiver}"> 29 </div> 30 </div> 31 <div class="layui-form-item"> 32 <div class="layui-input-block"> 33 <button class="layui-btn layui-btn-normal" 34 onclick="window.location.href='ContributeServlet?method=Check_The_Schedule'">返回</button> 35 </div> 36 </div> 37 </c:forEach> 38 </body> 39 </html>
Contribute_tuishenyijian.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>退审意见</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <table class="layui-table"> 15 <thead> 16 <tr> 17 <th>id</th> 18 <th>中文标题</th> 19 <th>中文摘要</th> 20 <th>中文关键字</th> 21 <th>内容</th> 22 <th>操作</th> 23 </tr> 24 </thead> 25 <tbody> 26 <c:forEach items="${list}" var="story" varStatus="status"> 27 <tr> 28 <td>${ status.index + 1}</td> 29 <td>${story.ctitle}</td> 30 <td>${story.cabstract}</td> 31 <td>${story.ckey}</td> 32 <td>${story.content}</td> 33 <td><button class="layui-btn layui-btn-normal" 34 onclick="window.location.href='ContributeServlet?method=look_opinion&ctitle=${story.ctitle}'">查看详情</button></td> 35 </tr> 36 </c:forEach> 37 </tbody> 38 </table> 39 </body> 40 </html>
Contribute_show.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>修改稿件</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <table class="layui-table"> 15 <thead> 16 <tr> 17 <th>id</th> 18 <th>中文标题</th> 19 <th>英文标题</th> 20 <th>内容</th> 21 <th>操作</th> 22 </tr> 23 </thead> 24 <tbody> 25 <c:forEach items="${list}" var="story" varStatus="status"> 26 <tr> 27 <td>${ status.index + 1}</td> 28 <td>${story.ctitle}</td> 29 <td>${story.etitle}</td> 30 <td>${story.content}</td> 31 <td><button class="layui-btn layui-btn-normal" 32 onclick="window.location.href='ContributeServlet?method=show&ctitle=${story.ctitle}'">修改</button></td> 33 </tr> 34 </c:forEach> 35 </tbody> 36 </table> 37 </body> 38 </html>
Contribute_Look_Opinion.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>退审意见</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <c:forEach items="${list}" var="storysituation"> 15 <div> 16 <label>中文标题:</label> <label>${storysituation.ctitle}</label> 17 </div> 18 <div> 19 <label>审签是否同意:</label> <label>${storysituation.shenqianAgree}</label> 20 </div> 21 <div> 22 <label>审签意见:</label> <label>${storysituation.shenqianOpinion}</label> 23 </div> 24 <div> 25 <label>查重结果:</label> <label>${storysituation.chachongResult}</label> 26 </div> 27 <div> 28 <label>审签人1是否同意:</label> <label>${storysituation.name_one_agree}</label> 29 </div> 30 <div> 31 <label>审签人1意见:</label> <label>${storysituation.name_one_opinion}</label> 32 </div> 33 <div> 34 <label>审签人2是否同意:</label> <label>${storysituation.name_two_agree}</label> 35 </div> 36 <div> 37 <label>审签人2意见:</label> <label>${storysituation.name_two_opinion}</label> 38 </div> 39 <div> 40 <label>审签人3是否同意:</label> <label>${storysituation.name_three_agree}</label> 41 </div> 42 <div> 43 <label>审签人3意见:</label> <label>${storysituation.name_three_opinion}</label> 44 </div> 45 <div> 46 <label>用户意见:</label> <label>${storysituation.user_oppose_opinion}</label> 47 </div> 48 <div> 49 <button class="layui-btn layui-btn-normal" 50 onclick="window.location.href='ContributeServlet?method=withdraw'">返回</button> 51 </div> 52 </c:forEach> 53 </body> 54 </html>
Contribute_chakanjindu.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>查看进度</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <table class="layui-table"> 15 <thead> 16 <tr> 17 <th>id</th> 18 <th>中文标题</th> 19 <th>内容</th> 20 <th>操作</th> 21 </tr> 22 </thead> 23 <tbody> 24 <c:forEach items="${list}" var="story" varStatus="status"> 25 <tr> 26 <td>${ status.index + 1}</td> 27 <td>${story.ctitle}</td> 28 <td>${story.content}</td> 29 <td><button class="layui-btn layui-btn-normal" 30 onclick="window.location.href='ContributeServlet?method=View_Progress&ctitle=${story.ctitle}'">点击详情</button></td> 31 </tr> 32 </c:forEach> 33 </tbody> 34 </table> 35 </body> 36 </html>
Contribute_alterpassword.jsp
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html> 4 <html> 5 <head> 6 <meta charset="UTF-8"> 7 <title>修改密码</title> 8 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 9 <script src=".//layui/layui.all.js"></script> 10 <script src=".//layui/layui.js"></script> 11 </head> 12 <body> 13 <form class="layui-form" action="ContributeServlet?method=updatePassword" 14 method="post"> 15 <div class="layui-form-item layui-form-text"> 16 <label class="layui-form-label">新密码</label> 17 <div class="layui-input-block"> 18 <input type="password" name="password" required lay-verify="required" 19 placeholder="请输入新密码" autocomplete="off" class="layui-input"> 20 </div> 21 </div> 22 <div class="layui-form-item"> 23 <div class="layui-input-block"> 24 <button class="layui-btn" lay-submit>确认修改</button> 25 <button type="reset" class="layui-btn layui-btn-primary">重置</button> 26 </div> 27 </div> 28 </form> 29 </body> 30 </html>
Contribute_alter.jsp
1 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 <%@ page language="java" contentType="text/html; charset=UTF-8" 3 pageEncoding="UTF-8"%> 4 <!DOCTYPE html> 5 <html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>修改稿件</title> 9 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 10 <script src=".//layui/layui.all.js"></script> 11 <script src=".//layui/layui.js"></script> 12 </head> 13 <body> 14 <form class="layui-form" action="ContributeServlet?method=update" 15 method="post"> 16 <c:forEach items="${list}" var="story"> 17 <div class="layui-form-item"> 18 <label class="layui-form-label">中文标题</label> 19 <div class="layui-input-block"> 20 <input type="text" name="ctitle" required lay-verify="required" 21 placeholder="请输入中文标题" autocomplete="off" class="layui-input" 22 value="${story.ctitle}"> <input type="text" 23 name="judgectitle" required lay-verify="required" 24 placeholder="请输入中文标题" autocomplete="off" class="layui-input" 25 value="${story.ctitle}"> 26 </div> 27 <div class="layui-form-mid layui-word-aux">(限100字以内)</div> 28 </div> 29 <div class="layui-form-item layui-form-text"> 30 <label class="layui-form-label">英文标题</label> 31 <div class="layui-input-block"> 32 <input type="text" name="etitle" required lay-verify="required" 33 placeholder="请输入英文标题" autocomplete="off" class="layui-input" 34 value="${story.etitle}"> 35 </div> 36 <div class="layui-form-mid layui-word-aux">(限400个字符以内)</div> 37 </div> 38 <div class="layui-form-item"> 39 <label class="layui-form-label">中文摘要</label> 40 <div class="layui-inline"> 41 <input type="text" name="cabstract" required lay-verify="required" 42 placeholder="请输入中文摘要" autocomplete="off" class="layui-input" 43 value="${story.cabstract}"> 44 </div> 45 <div class="layui-form-mid layui-word-aux">(限300字以内)</div> 46 </div> 47 <div class="layui-form-item"> 48 <label class="layui-form-label">英文摘要</label> 49 <div class="layui-inline"> 50 <input type="text" name="eabstract" required lay-verify="required" 51 placeholder="请输入英文摘要" autocomplete="off" class="layui-input" 52 value="${story.eabstract}"> 53 </div> 54 <div class="layui-form-mid layui-word-aux">(限3000字符以内)</div> 55 </div> 56 <div class="layui-form-item"> 57 <label class="layui-form-label">中文关键字</label> 58 <div class="layui-inline"> 59 <input type="text" name="ckey" required lay-verify="required" 60 placeholder="请输入中文关键字" autocomplete="off" class="layui-input" 61 value="${story.ckey}"> 62 </div> 63 <div class="layui-form-mid layui-word-aux">(限100字以内)</div> 64 </div> 65 <div class="layui-form-item"> 66 <label class="layui-form-label">英文关键字</label> 67 <div class="layui-inline"> 68 <input type="text" name="ekey" required lay-verify="required" 69 placeholder="请输入英文关键字" autocomplete="off" class="layui-input" 70 value="${story.ekey}"> 71 </div> 72 <div class="layui-form-mid layui-word-aux">(限200个字符以内)</div> 73 </div> 74 <div class="layui-form-item layui-form-text"> 75 <label class="layui-form-label">稿件正文</label> 76 <div class="layui-input-block"> 77 <textarea name="content" placeholder="请输入稿件正文" 78 class="layui-textarea">${story.content}</textarea> 79 </div> 80 </div> 81 <div class="layui-form-item"> 82 <label class="layui-form-label">投稿人</label> 83 <div class="layui-input-block"> 84 <input type="text" name="name" required lay-verify="required" 85 placeholder="请输入您的账号" autocomplete="off" class="layui-input" 86 value="${story.name}"> 87 </div> 88 </div> 89 <div class="layui-form-item"> 90 <div class="layui-input-block"> 91 <button class="layui-btn" lay-submit>修改</button> 92 <button type="reset" class="layui-btn layui-btn-primary">重置</button> 93 </div> 94 </div> 95 </c:forEach> 96 </form> 97 </body> 98 </html>
Contribute_submit.jsp
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html> 4 <html> 5 <head> 6 <meta charset="UTF-8"> 7 <title>我要投稿</title> 8 <link rel="stylesheet" href=".//layui/css/layui.css" media="all"> 9 <script src=".//layui/layui.all.js"></script> 10 <script src=".//layui/layui.js"></script> 11 </head> 12 <body> 13 <form class="layui-form" 14 action="ContributeServlet?method=submit" method="post"> 15 <div class="layui-form-item"> 16 <label class="layui-form-label">中文标题</label> 17 <div class="layui-input-block"> 18 <input type="text" name="ctitle" required lay-verify="required" 19 placeholder="请输入中文标题" autocomplete="off" class="layui-input"> 20 </div> 21 <div class="layui-form-mid layui-word-aux">(限100字以内)</div> 22 </div> 23 <div class="layui-form-item layui-form-text"> 24 <label class="layui-form-label">英文标题</label> 25 <div class="layui-input-block"> 26 <input type="text" name="etitle" required lay-verify="required" 27 placeholder="请输入英文标题" autocomplete="off" class="layui-input"> 28 </div> 29 <div class="layui-form-mid layui-word-aux">(限400个字符以内)</div> 30 </div> 31 <div class="layui-form-item"> 32 <label class="layui-form-label">中文摘要</label> 33 <div class="layui-inline"> 34 <input type="text" name="cabstract" required lay-verify="required" 35 placeholder="请输入中文摘要" autocomplete="off" class="layui-input"> 36 </div> 37 <div class="layui-form-mid layui-word-aux">(限300字以内)</div> 38 </div> 39 <div class="layui-form-item"> 40 <label class="layui-form-label">英文摘要</label> 41 <div class="layui-inline"> 42 <input type="text" name="eabstract" required lay-verify="required" 43 placeholder="请输入英文摘要" autocomplete="off" class="layui-input"> 44 </div> 45 <div class="layui-form-mid layui-word-aux">(限3000字符以内)</div> 46 </div> 47 <div class="layui-form-item"> 48 <label class="layui-form-label">中文关键字</label> 49 <div class="layui-inline"> 50 <input type="text" name="ckey" required lay-verify="required" 51 placeholder="请输入中文关键字" autocomplete="off" class="layui-input"> 52 </div> 53 <div class="layui-form-mid layui-word-aux">(限100字以内)</div> 54 </div> 55 <div class="layui-form-item"> 56 <label class="layui-form-label">英文关键字</label> 57 <div class="layui-inline"> 58 <input type="text" name="ekey" required lay-verify="required" 59 placeholder="请输入英文关键字" autocomplete="off" class="layui-input"> 60 </div> 61 <div class="layui-form-mid layui-word-aux">(限200个字符以内)</div> 62 </div> 63 <div class="layui-form-item layui-form-text"> 64 <label class="layui-form-label">稿件正文</label> 65 <div class="layui-input-block"> 66 <textarea name="content" placeholder="请输入稿件正文" 67 class="layui-textarea"></textarea> 68 </div> 69 </div> 70 <div class="layui-form-item"> 71 <label class="layui-form-label">投稿人</label> 72 <div class="layui-input-block"> 73 <input type="text" name="name" required 74 lay-verify="required" placeholder="请输入您的账号" autocomplete="off" 75 class="layui-input"> 76 </div> 77 </div> 78 <div class="layui-form-item"> 79 <div class="layui-input-block"> 80 <button class="layui-btn" lay-submit>立即提交</button> 81 <button type="reset" class="layui-btn layui-btn-primary">重置</button> 82 </div> 83 </div> 84 </form> 85 </body> 86 </html>
Story.java(在util文件下建立此java文件)
1 package util; 2 3 /** 4 * 稿件 5 * @author Administrator 6 * 7 */ 8 public class Story { 9 private String ctitle;//中文标题 10 private String etitle;//英文标题 11 private String cabstract;//中文摘要 12 private String eabstract;//英文摘要 13 private String ckey;//中文关键字 14 private String ekey;//英文关键字 15 private String content;//稿件内容 16 private String receiver;//接收方,方便查询相关状态 17 private String status;//稿件状态,1为OK,0为撤稿 18 private String name;//投稿人 19 public Story(String ctitle,String etitle,String cabstract,String eabstract,String ckey,String ekey,String content,String receiver,String status,String name) { 20 super(); 21 this.ctitle=ctitle; 22 this.etitle=etitle; 23 this.cabstract=cabstract; 24 this.eabstract=eabstract; 25 this.ckey=ckey; 26 this.ekey=ekey; 27 this.content=content; 28 this.receiver=receiver; 29 this.status=status; 30 this.name=name; 31 } 32 public Story(String ctitle, String etitle, String cabstract, String eabstract, String ckey, String ekey, 33 String content, String name) { 34 super(); 35 this.ctitle=ctitle; 36 this.etitle=etitle; 37 this.cabstract=cabstract; 38 this.eabstract=eabstract; 39 this.ckey=ckey; 40 this.ekey=ekey; 41 this.content=content; 42 this.name=name; 43 } 44 public String getCtitle() { 45 return ctitle; 46 } 47 public void setCtitle(String ctitle) { 48 this.ctitle = ctitle; 49 } 50 public String getEtitle() { 51 return etitle; 52 } 53 public void setEtitle(String etitle) { 54 this.etitle = etitle; 55 } 56 public String getCabstract() { 57 return cabstract; 58 } 59 public void setCabstract(String cabstract) { 60 this.cabstract = cabstract; 61 } 62 public String getEabstract() { 63 return eabstract; 64 } 65 public void setEabstract(String eabstract) { 66 this.eabstract = eabstract; 67 } 68 public String getCkey() { 69 return ckey; 70 } 71 public void setCkey(String ckey) { 72 this.ckey = ckey; 73 } 74 public String getEkey() { 75 return ekey; 76 } 77 public void setEkey(String ekey) { 78 this.ekey = ekey; 79 } 80 public String getContent() { 81 return content; 82 } 83 public void setContent(String content) { 84 this.content = content; 85 } 86 public String getReceiver() { 87 return receiver; 88 } 89 public void setReceiver(String receiver) { 90 this.receiver = receiver; 91 } 92 public String getStatus() { 93 return status; 94 } 95 public void setStatus(String status) { 96 this.status = status; 97 } 98 public String getName() { 99 return name; 100 } 101 public void setName(String name) { 102 this.name = name; 103 } 104 }
StorySituation.java(在util文件下建立此java文件)
1 package util; 2 3 public class StorySituation { 4 private String ctitle; 5 private String receiver;// 接收方,方便查询相关状态 6 private String shenqianAgree;// 审签是否同意 7 private String shenqianOpinion;// 审签意见 8 private String chachongResult;// 查重结果 9 private String name_one; 10 private String name_two; 11 private String name_three; 12 private String name_one_agree; 13 private String name_two_agree; 14 private String name_three_agree; 15 private String name_one_opinion; 16 private String name_two_opinion; 17 private String name_three_opinion; 18 private String user_oppose_opinion;// 用户反馈意见 19 20 public StorySituation(String ctitle, String shenqianAgree, String shenqianOpinion, String chachongResult, 21 String name_one, String name_one_agree, String name_one_opinion, String name_two, String name_two_agree, 22 String name_two_opinion, String name_three, String name_three_agree, String name_three_opinion) { 23 // TODO Auto-generated constructor stub 24 this.ctitle = ctitle; 25 this.shenqianAgree = shenqianAgree; 26 this.shenqianOpinion = shenqianOpinion; 27 this.chachongResult = chachongResult; 28 this.name_one = name_one; 29 this.name_one_agree = name_one_agree; 30 this.name_one_opinion = name_one_opinion; 31 this.name_two = name_two; 32 this.name_two_agree = name_two_agree; 33 this.name_two_opinion = name_two_opinion; 34 this.name_three = name_three; 35 this.name_three_agree = name_three_agree; 36 this.name_three_opinion = name_three_opinion; 37 } 38 39 public StorySituation(String ctitle, String user_oppose_opinion) { 40 // TODO Auto-generated constructor stub 41 this.ctitle = ctitle; 42 this.user_oppose_opinion = user_oppose_opinion; 43 } 44 45 public StorySituation(String ctitle, String receiver, String shenqianAgree, String shenqianOpinion, 46 String chachongResult, String name_one, String name_one_agree, String name_one_opinion, String name_two, 47 String name_two_agree, String name_two_opinion, String name_three, String name_three_agree, 48 String name_three_opinion, String user_oppose_opinion) { 49 // TODO Auto-generated constructor stub 50 this.ctitle = ctitle; 51 this.receiver = receiver; 52 this.shenqianAgree = shenqianAgree; 53 this.shenqianOpinion = shenqianOpinion; 54 this.chachongResult = chachongResult; 55 this.name_one = name_one; 56 this.name_one_agree = name_one_agree; 57 this.name_one_opinion = name_one_opinion; 58 this.name_two = name_two; 59 this.name_two_agree = name_two_agree; 60 this.name_two_opinion = name_two_opinion; 61 this.name_three = name_three; 62 this.name_three_agree = name_three_agree; 63 this.name_three_opinion = name_three_opinion; 64 this.user_oppose_opinion = user_oppose_opinion; 65 } 66 67 public String getCtitle() { 68 return ctitle; 69 } 70 71 public void setCtitle(String ctitle) { 72 this.ctitle = ctitle; 73 } 74 75 public String getReceiver() { 76 return receiver; 77 } 78 79 public void setReceiver(String receiver) { 80 this.receiver = receiver; 81 } 82 83 public String getShenqianAgree() { 84 return shenqianAgree; 85 } 86 87 public void setShenqianAgree(String shenqianAgree) { 88 this.shenqianAgree = shenqianAgree; 89 } 90 91 public String getShenqianOpinion() { 92 return shenqianOpinion; 93 } 94 95 public void setShenqianOpinion(String shenqianOpinion) { 96 this.shenqianOpinion = shenqianOpinion; 97 } 98 99 public String getChachongResult() { 100 return chachongResult; 101 } 102 103 public void setChachongResult(String chachongResult) { 104 this.chachongResult = chachongResult; 105 } 106 107 public String getName_one() { 108 return name_one; 109 } 110 111 public void setName_one(String name_one) { 112 this.name_one = name_one; 113 } 114 115 public String getName_two() { 116 return name_two; 117 } 118 119 public void setName_two(String name_two) { 120 this.name_two = name_two; 121 } 122 123 public String getName_three() { 124 return name_three; 125 } 126 127 public void setName_three(String name_three) { 128 this.name_three = name_three; 129 } 130 131 public String getName_one_agree() { 132 return name_one_agree; 133 } 134 135 public void setName_one_agree(String name_one_agree) { 136 this.name_one_agree = name_one_agree; 137 } 138 139 public String getName_two_agree() { 140 return name_two_agree; 141 } 142 143 public void setName_two_agree(String name_two_agree) { 144 this.name_two_agree = name_two_agree; 145 } 146 147 public String getName_three_agree() { 148 return name_three_agree; 149 } 150 151 public void setName_three_agree(String name_three_agree) { 152 this.name_three_agree = name_three_agree; 153 } 154 155 public String getName_one_opinion() { 156 return name_one_opinion; 157 } 158 159 public void setName_one_opinion(String name_one_opinion) { 160 this.name_one_opinion = name_one_opinion; 161 } 162 163 public String getName_two_opinion() { 164 return name_two_opinion; 165 } 166 167 public void setName_two_opinion(String name_two_opinion) { 168 this.name_two_opinion = name_two_opinion; 169 } 170 171 public String getName_three_opinion() { 172 return name_three_opinion; 173 } 174 175 public void setName_three_opinion(String name_three_opinion) { 176 this.name_three_opinion = name_three_opinion; 177 } 178 179 public String getUser_oppose_opinion() { 180 return user_oppose_opinion; 181 } 182 183 public void setUser_oppose_opinion(String user_oppose_opinion) { 184 this.user_oppose_opinion = user_oppose_opinion; 185 } 186 }
ContributeServlet.java(在servlet文件下建立此java文件)
1 package servlet; 2 3 import java.io.IOException; 4 import java.util.List; 5 6 import javax.servlet.ServletException; 7 import javax.servlet.annotation.WebServlet; 8 import javax.servlet.http.HttpServlet; 9 import javax.servlet.http.HttpServletRequest; 10 import javax.servlet.http.HttpServletResponse; 11 import javax.servlet.http.HttpSession; 12 import javax.swing.JOptionPane; 13 14 import dao.ContributeDao; 15 import util.Story; 16 import util.StorySituation; 17 18 /** 19 * Servlet implementation class ContributeServlet 20 */ 21 @WebServlet("/ContributeServlet") 22 public class ContributeServlet extends HttpServlet { 23 private static final long serialVersionUID = 1L; 24 25 /** 26 * @see HttpServlet#HttpServlet() 27 */ 28 public ContributeServlet() { 29 super(); 30 // TODO Auto-generated constructor stub 31 } 32 33 ContributeDao dao = new ContributeDao(); 34 35 /** 36 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 37 * response) 38 */ 39 protected void doGet(HttpServletRequest request, HttpServletResponse response) 40 throws ServletException, IOException { 41 // TODO Auto-generated method stub 42 // response.getWriter().append("Served at: ").append(request.getContextPath()); 43 doPost(request, response); 44 } 45 46 /** 47 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 48 * response) 49 */ 50 protected void doPost(HttpServletRequest request, HttpServletResponse response) 51 throws ServletException, IOException { 52 // TODO Auto-generated method stub 53 // doGet(request, response); 54 55 request.setCharacterEncoding("utf-8"); 56 response.setCharacterEncoding("utf-8"); 57 58 System.out.println("进入ContributeServlet"); 59 String method = request.getParameter("method"); 60 System.out.println(method); 61 if ("submit".equals(method)) { 62 submit(request, response);// 创建稿件 63 } else if ("alter".equals(method)) { 64 alter(request, response);// 修改稿件 65 } else if ("show".equals(method)) { 66 show(request, response); 67 } else if ("update".equals(method)) { 68 update(request, response); 69 } else if ("updatePassword".equals(method)) { 70 updatePassword(request, response); 71 } else if ("Check_The_Schedule".equals(method)) { 72 Check_The_Schedule(request, response);// 查看进度 73 } else if ("View_Progress".equals(method)) { 74 View_Progress(request, response); 75 } else if ("withdraw".equals(method)) { 76 withdraw(request, response);// 退审意见 77 } else if ("look_opinion".equals(method)) { 78 look_opinion(request, response); 79 } 80 81 } 82 83 public void submit(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 84 response.setCharacterEncoding("UTF-8"); 85 request.setCharacterEncoding("UTF-8"); 86 87 String ctitle = request.getParameter("ctitle"); 88 String etitle = request.getParameter("etitle"); 89 String cabstract = request.getParameter("cabstract"); 90 String eabstract = request.getParameter("eabstract"); 91 String ckey = request.getParameter("ckey"); 92 String ekey = request.getParameter("ekey"); 93 String content = request.getParameter("content"); 94 String name = request.getParameter("name"); 95 96 Story story = new Story(ctitle, etitle, cabstract, eabstract, ckey, ekey, content, "格式审查中", "1", name); 97 98 if (dao.submit(story)) { 99 JOptionPane.showMessageDialog(null, "投稿成功", "success", JOptionPane.PLAIN_MESSAGE); 100 request.getRequestDispatcher("Contribute_submit.jsp").forward(request, response); 101 } else { 102 request.getRequestDispatcher("TestFail.jsp").forward(request, response); 103 } 104 105 } 106 107 public void alter(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 108 response.setCharacterEncoding("UTF-8"); 109 request.setCharacterEncoding("UTF-8"); 110 111 // 使用request对象的getSession()获取session,如果session不存在则创建一个 112 HttpSession session = request.getSession(); 113 // 将数据取出 114 String name = (String) session.getAttribute("username"); 115 116 List<Story> list = dao.alter(name); 117 request.setAttribute("list", list); 118 request.getRequestDispatcher("Contribute_show.jsp").forward(request, response); 119 120 } 121 122 public void show(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 123 response.setCharacterEncoding("UTF-8"); 124 request.setCharacterEncoding("UTF-8"); 125 126 String ctitle = request.getParameter("ctitle"); 127 System.out.println("中文标题:" + ctitle); 128 List<Story> list = dao.show(ctitle); 129 request.setAttribute("list", list); 130 request.getRequestDispatcher("Contribute_alter.jsp").forward(request, response); 131 132 } 133 134 public void update(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 135 response.setCharacterEncoding("UTF-8"); 136 request.setCharacterEncoding("UTF-8"); 137 138 String ctitle = request.getParameter("ctitle"); 139 String etitle = request.getParameter("etitle"); 140 String cabstract = request.getParameter("cabstract"); 141 String eabstract = request.getParameter("eabstract"); 142 String ckey = request.getParameter("ckey"); 143 String ekey = request.getParameter("ekey"); 144 String content = request.getParameter("content"); 145 String name = request.getParameter("name"); 146 String judgectitle = request.getParameter("judgectitle"); 147 148 Story story = new Story(ctitle, etitle, cabstract, eabstract, ckey, ekey, content, name); 149 150 if (dao.update(story, judgectitle)) { 151 request.getRequestDispatcher("ContributeServlet?method=alter").forward(request, response); 152 } else { 153 request.getRequestDispatcher("TestFail.jsp").forward(request, response); 154 } 155 156 } 157 158 public void updatePassword(HttpServletRequest request, HttpServletResponse response) 159 throws ServletException, IOException { 160 response.setCharacterEncoding("UTF-8"); 161 request.setCharacterEncoding("UTF-8"); 162 163 // 使用request对象的getSession()获取session,如果session不存在则创建一个 164 HttpSession session = request.getSession(); 165 // 将数据取出 166 String name = (String) session.getAttribute("username"); 167 168 String password = request.getParameter("password"); 169 170 if (dao.updatePassword(name, password)) { 171 JOptionPane.showMessageDialog(null, "修改成功", "success", JOptionPane.PLAIN_MESSAGE); 172 request.getRequestDispatcher("Contribute_alterpassword.jsp").forward(request, response); 173 } else { 174 request.getRequestDispatcher("TestFail.jsp").forward(request, response); 175 } 176 177 } 178 179 public void Check_The_Schedule(HttpServletRequest request, HttpServletResponse response) 180 throws ServletException, IOException { 181 response.setCharacterEncoding("UTF-8"); 182 request.setCharacterEncoding("UTF-8"); 183 184 // 使用request对象的getSession()获取session,如果session不存在则创建一个 185 HttpSession session = request.getSession(); 186 // 将数据取出 187 String name = (String) session.getAttribute("username"); 188 189 List<Story> list = dao.alter(name); 190 request.setAttribute("list", list); 191 request.getRequestDispatcher("Contribute_chakanjindu.jsp").forward(request, response); 192 193 } 194 195 public void View_Progress(HttpServletRequest request, HttpServletResponse response) 196 throws ServletException, IOException { 197 response.setCharacterEncoding("UTF-8"); 198 request.setCharacterEncoding("UTF-8"); 199 200 String ctitle = request.getParameter("ctitle"); 201 System.out.println("中文标题:" + ctitle); 202 List<Story> list = dao.show(ctitle); 203 request.setAttribute("list", list); 204 request.getRequestDispatcher("Contribute_view_progress.jsp").forward(request, response); 205 206 } 207 208 public void withdraw(HttpServletRequest request, HttpServletResponse response) 209 throws ServletException, IOException { 210 response.setCharacterEncoding("UTF-8"); 211 request.setCharacterEncoding("UTF-8"); 212 213 // 使用request对象的getSession()获取session,如果session不存在则创建一个 214 HttpSession session = request.getSession(); 215 // 将数据取出 216 String name = (String) session.getAttribute("username"); 217 218 List<Story> list = dao.withdraw(name); 219 request.setAttribute("list", list); 220 request.getRequestDispatcher("Contribute_tuishenyijian.jsp").forward(request, response); 221 222 } 223 224 public void look_opinion(HttpServletRequest request, HttpServletResponse response) 225 throws ServletException, IOException { 226 response.setCharacterEncoding("UTF-8"); 227 request.setCharacterEncoding("UTF-8"); 228 229 String ctitle = request.getParameter("ctitle"); 230 List<StorySituation> list = dao.look_opinion(ctitle); 231 request.setAttribute("list", list); 232 request.getRequestDispatcher("Contribute_Look_Opinion.jsp").forward(request, response); 233 234 } 235 236 }
ContributeDao.java(在dao文件下建立此java文件)
1 package dao; 2 3 import java.sql.Connection; 4 import java.sql.PreparedStatement; 5 import java.sql.ResultSet; 6 import java.util.ArrayList; 7 import java.util.List; 8 9 import databse.Database; 10 import util.Story; 11 import util.StorySituation; 12 13 public class ContributeDao { 14 /** 15 * 投稿 16 * 17 * @param story 18 * @return 19 */ 20 public boolean submit(Story story) { 21 Connection conn = null; 22 PreparedStatement pstm = null; 23 PreparedStatement pstm1 = null; 24 boolean judge = false; 25 try { 26 conn = Database.getConnection(); 27 String sql = "insert into story(ctitle,etitle,cabstract,eabstract,ckey,ekey,content,receiver,status,name) values(?,?,?,?,?,?,?,?,?,?)"; 28 System.out.println(sql); 29 pstm = conn.prepareStatement(sql); 30 31 pstm.setString(1, story.getCtitle()); 32 pstm.setString(2, story.getEtitle()); 33 pstm.setString(3, story.getCabstract()); 34 pstm.setString(4, story.getEabstract()); 35 pstm.setString(5, story.getCkey()); 36 pstm.setString(6, story.getEkey()); 37 pstm.setString(7, story.getContent()); 38 pstm.setString(8, story.getReceiver()); 39 pstm.setString(9, story.getStatus()); 40 pstm.setString(10, story.getName()); 41 42 String sql1 = "insert into storysituation(ctitle,receiver) values(?,?)"; 43 pstm1 = conn.prepareStatement(sql1); 44 pstm1.setString(1, story.getCtitle()); 45 pstm1.setString(2, story.getReceiver()); 46 47 // 执行插入操作 48 int num = pstm.executeUpdate(); 49 int num1 = pstm1.executeUpdate(); 50 if (num > 0 && num1 > 0) { 51 System.out.println("投稿成功"); 52 judge = true; 53 } else { 54 System.out.println("投稿失败"); 55 judge = false; 56 } 57 } catch (Exception e) { 58 e.printStackTrace(); 59 } finally { 60 // SQL执行完成后释放相关资源 61 Database.close(conn, pstm); 62 } 63 return judge; 64 } 65 66 /** 67 * 修改 查询稿件 68 * 69 * @return 70 */ 71 public List<Story> alter(String name) { 72 List<Story> list = new ArrayList<>(); 73 Connection conn = null; 74 ResultSet rs = null; 75 PreparedStatement pstm = null; 76 Story story = null; 77 try { 78 conn = Database.getConnection(); 79 String sql = "select * from story where name=?"; 80 pstm = conn.prepareStatement(sql); 81 pstm.setString(1, name); 82 rs = pstm.executeQuery(); 83 while (rs.next()) { 84 String ctitle = rs.getString("ctitle"); 85 String etitle = rs.getString("etitle"); 86 String cabstract = rs.getString("cabstract"); 87 String eabstract = rs.getString("eabstract"); 88 String ckey = rs.getString("ckey"); 89 String ekey = rs.getString("ekey"); 90 String content = rs.getString("content"); 91 String receiver = rs.getString("receiver"); 92 String status = rs.getString("status"); 93 String namee = rs.getString("name"); 94 story = new Story(ctitle, etitle, cabstract, eabstract, ckey, ekey, content, receiver, status, namee); 95 list.add(story); 96 } 97 } catch (Exception e) { 98 e.printStackTrace(); 99 } finally { 100 Database.close(conn, pstm, rs); 101 } 102 return list; 103 } 104 105 public List<Story> show(String ctitle) { 106 System.out.println("进入dao.show()"); 107 List<Story> list = new ArrayList<>(); 108 Connection conn = null; 109 ResultSet rs = null; 110 PreparedStatement pstm = null; 111 Story story = null; 112 try { 113 conn = Database.getConnection(); 114 String sql = "select * from story where ctitle=?"; 115 pstm = conn.prepareStatement(sql); 116 pstm.setString(1, ctitle); 117 rs = pstm.executeQuery(); 118 while (rs.next()) { 119 String ctitlee = rs.getString("ctitle"); 120 String etitle = rs.getString("etitle"); 121 String cabstract = rs.getString("cabstract"); 122 String eabstract = rs.getString("eabstract"); 123 String ckey = rs.getString("ckey"); 124 String ekey = rs.getString("ekey"); 125 String content = rs.getString("content"); 126 String receiver = rs.getString("receiver"); 127 String status = rs.getString("status"); 128 String namee = rs.getString("name"); 129 story = new Story(ctitlee, etitle, cabstract, eabstract, ckey, ekey, content, receiver, status, namee); 130 list.add(story); 131 } 132 } catch (Exception e) { 133 e.printStackTrace(); 134 } finally { 135 Database.close(conn, pstm, rs); 136 } 137 return list; 138 } 139 140 public boolean update(Story story, String judgectitle) { 141 Connection conn = null; 142 PreparedStatement pstm = null; 143 boolean judge = false; 144 try { 145 conn = Database.getConnection(); 146 String sql = "update story set ctitle=?,etitle=?,cabstract=?,eabstract=?,ckey=?,ekey=?,content=?,name=? where ctitle=?"; 147 pstm = conn.prepareStatement(sql); 148 pstm.setString(1, story.getCtitle()); 149 pstm.setString(2, story.getEtitle()); 150 pstm.setString(3, story.getCabstract()); 151 pstm.setString(4, story.getEabstract()); 152 pstm.setString(5, story.getCkey()); 153 pstm.setString(6, story.getEkey()); 154 pstm.setString(7, story.getContent()); 155 pstm.setString(8, story.getName()); 156 pstm.setString(9, judgectitle); 157 // 执行插入操作 158 int num = pstm.executeUpdate(); 159 if (num > 0) { 160 System.out.println("修改成功"); 161 judge = true; 162 } else { 163 System.out.println("修改失败"); 164 judge = false; 165 } 166 } catch (Exception e) { 167 e.printStackTrace(); 168 } finally { 169 // SQL执行完成后释放相关资源 170 Database.close(conn, pstm); 171 } 172 return judge; 173 } 174 175 public boolean updatePassword(String name, String password) { 176 Connection conn = null; 177 PreparedStatement pstm = null; 178 PreparedStatement pstm1 = null; 179 boolean judge = false; 180 try { 181 conn = Database.getConnection(); 182 String sql = "update user set password=? where name=?"; 183 String sql1 = "update login set password=? where name=?"; 184 pstm = conn.prepareStatement(sql); 185 pstm1 = conn.prepareStatement(sql1); 186 pstm.setString(1, password); 187 pstm.setString(2, name); 188 pstm1.setString(1, password); 189 pstm1.setString(2, name); 190 // 执行插入操作 191 int num = pstm.executeUpdate(); 192 int num1 = pstm1.executeUpdate(); 193 if (num > 0 && num1 > 0) { 194 System.out.println("修改密码成功"); 195 judge = true; 196 } else { 197 System.out.println("修改密码失败"); 198 judge = false; 199 } 200 } catch (Exception e) { 201 e.printStackTrace(); 202 } finally { 203 // SQL执行完成后释放相关资源 204 Database.close(conn, pstm); 205 } 206 return judge; 207 } 208 209 /** 210 * 退审意见 211 * 212 * @return 213 */ 214 public List<Story> withdraw(String name) { 215 List<Story> list = new ArrayList<>(); 216 Connection conn = null; 217 ResultSet rs = null; 218 PreparedStatement pstm = null; 219 Story story = null; 220 try { 221 conn = Database.getConnection(); 222 String sql = "select * from story where receiver=? And name=?"; 223 pstm = conn.prepareStatement(sql); 224 pstm.setString(1, "稿件已退回"); 225 pstm.setString(2, name); 226 rs = pstm.executeQuery(); 227 while (rs.next()) { 228 String ctitle = rs.getString("ctitle"); 229 String etitle = rs.getString("etitle"); 230 String cabstract = rs.getString("cabstract"); 231 String eabstract = rs.getString("eabstract"); 232 String ckey = rs.getString("ckey"); 233 String ekey = rs.getString("ekey"); 234 String content = rs.getString("content"); 235 String receiver = rs.getString("receiver"); 236 String status = rs.getString("status"); 237 String namee = rs.getString("name"); 238 story = new Story(ctitle, etitle, cabstract, eabstract, ckey, ekey, content, receiver, status, namee); 239 list.add(story); 240 } 241 } catch (Exception e) { 242 e.printStackTrace(); 243 } finally { 244 Database.close(conn, pstm, rs); 245 } 246 return list; 247 } 248 249 public List<StorySituation> look_opinion(String ctitle) { 250 List<StorySituation> list = new ArrayList<>(); 251 Connection conn = null; 252 ResultSet rs = null; 253 PreparedStatement pstm = null; 254 StorySituation storySituation = null; 255 try { 256 conn = Database.getConnection(); 257 String sql = "select * from storysituation where ctitle=?"; 258 pstm = conn.prepareStatement(sql); 259 pstm.setString(1, ctitle); 260 rs = pstm.executeQuery(); 261 while (rs.next()) { 262 String ctitlee = rs.getString("ctitle"); 263 String receiver = rs.getString("receiver"); 264 String shenqianAgree = rs.getString("shenqianAgree"); 265 String shenqianOpinion = rs.getString("shenqianOpinion"); 266 String chachongResult = rs.getString("chachongResult"); 267 String name_one = rs.getString("name_one"); 268 String name_one_agree = rs.getString("name_one_agree"); 269 String name_one_opinion = rs.getString("name_one_opinion"); 270 String name_two = rs.getString("name_two"); 271 String name_two_agree = rs.getString("name_two_agree"); 272 String name_two_opinion = rs.getString("name_two_opinion"); 273 String name_three = rs.getString("name_three"); 274 String name_three_agree = rs.getString("name_three_agree"); 275 String name_three_opinion = rs.getString("name_three_opinion"); 276 String user_oppose_opinion = rs.getString("user_oppose_opinion"); 277 storySituation = new StorySituation(ctitlee, receiver, shenqianAgree, shenqianOpinion, chachongResult, 278 name_one, name_one_agree, name_one_opinion, name_two, name_two_agree, name_two_opinion, 279 name_three, name_three_agree, name_three_opinion, user_oppose_opinion); 280 list.add(storySituation); 281 } 282 } catch (Exception e) { 283 e.printStackTrace(); 284 } finally { 285 Database.close(conn, pstm, rs); 286 } 287 return list; 288 } 289 }