嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元微信扫码支付:3 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
毕业设计管理系统是一个为适应当前毕业设计管理工作的需求而设计开发的软件系统。该系统的页面是在JSP页面中写入了HTML5标签、jQuery脚本做动态效果和表单验证,整体框架使用Struts2进行页面跳转的控制,WEB服务器使用Tomcat服务器,后台数据库采用的是MySQL数据库。系统的用户包括四个角色:学生,教师,系管理员,系统管理员。
<!—文件上传的表单 -->
<form action="uploadpaper?taskid=${task.taskid }" method="post" enctype="multipart/form-data">
<label class="required" for="paper">选择文件</label>
<input type="file" name="paper" id="paper" class="half"/>
<input type="submit" class="btn btn-green big" value="上传"/>
</form>
<!-- struts2 的相应配置 -->
<action name="uploadpaper" class="org.pigeon.gradpro.action.UploadAction" method="uploadPaper">
<result name="success">/success.jsp</result>
<result name="input">/notexist.jsp</result>
<param name="savePath">/paper</param>
<!-- 上传最大值 -->
<param name="maximumSize">104857600</param>
</action>
//上传文件,同时将原文件名和新文件名写入到数据库中
public String uploadPaper(){
if(paperFileName == "" || paperFileName == null){
message = "没有选择要上传的文件";
return "success";
}
//文件名后缀
String suffix = paperFileName.split("\\.")[paperFileName.split("\\.").length - 1];
//随机生成的纯数字文件名
newPaperName = BaseUnit.getLoginUser().getUsername() "-" new Random().nextInt(999999) "." suffix;
String dstPath = ServletActionContext.getServletContext().getRealPath(this.getSavePath())
"/" newPaperName;
File dstFile = new File(dstPath);
copy(this.paper, dstFile);
PaperDAO paperDao = new PaperDAO();
TaskDAO taskDao = new TaskDAO();
try {
paperDao.insertPaper(taskid, paperFileName, newPaperName);
taskDao.updateStatus(taskid, "8"); //修改课题状态
} catch (SQLException e) {
e.printStackTrace();
message = "系统错误";
return "notexist";
}
message = "上传论文成功!";
return "success";
}
//自定义的复制文件的方法
public static void copy(File src, File dst){
InputStream in = null ;
OutputStream out = null ;
try {
in = new BufferedInputStream( new FileInputStream(src), BUFFER_SIZE );
out = new BufferedOutputStream( new FileOutputStream(dst),
BUFFER_SIZE );
byte [] buffer = new byte [ BUFFER_SIZE ];
int len = 0;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if ( null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if ( null != out) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}