基于SSM的在线考试系统


基于Spring+SpringMVC+MyBatis的在线考试系统。详情的介绍在我的帖子里都有,欢迎大家指点
资源截图
代码片段和文件信息
package top.sdszhq.controller;

import com.google.gson.Gson;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.sdszhq.pojo.ExamResult;
import top.sdszhq.service.ExamRankService;
import top.sdszhq.utils.ExcelUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Controller
public class ExamExport {
    @Autowired
    public ExamRankService ers;


    @ResponseBody
    @RequestMapping(value = “/html/rankExport.action“produces = “application/json; charset=utf-8“)
    public String rankExport(@RequestBody Map map HttpServletRequest request HttpServletResponse response) {
        String examCode = map.get(“examCode“);
        List list = new ArrayList<>();
        list = ers.selectExamRank(examCode);
        return new Gson().toJson(list);
       /* String[] title = {“考试排名““考生账号““考试姓名““分数“};

        //excel文件名
        String fileName = “学生成绩表“+System.currentTimeMillis()+“.xls“;

        //sheet名
        String sheetName = “学生成绩表“;

        String[][] content = new String[ list.size() ][ title.length ];

        for (int i = 0; i < list.size(); i++) {
            content[i][0] = String.valueOf(i);
            content[i][1] = list.get(i).getStudentaccount().toString();
            content[i][2] = list.get(i).getStudentName().toString();
            content[i][3] = list.get(i).getScore().toString();
        }

        //创建HSSFWorkbook
        HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(sheetName title content null);

        //响应到客户端
        try {
            this.setResponseHeader(response fileName);
            OutputStream os = response.getOutputStream();
            wb.write(os);
            os.flush();
            os.close();
        } catch (Exception e) {
            e.printStackTrace();
        }*/
    }

    //发送响应流方法
    public void setResponseHeader(HttpServletResponse response String fileName) {
        try {
            try {
                fileName = new String(fileName.getBytes()“ISO8859-1“);
            } catch (UnsupportedEncodingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            response.setContentType(“application/octet-stream;charset=ISO8859-1“);
            response.setHeader(“Content-Disposition“ “attachment;filename=“+ fileName);
            response.addHeader(“Pargam“ “no-cache“);
            response.addHeader(“Cache-Control“ “no-cache“);
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         21  2019-06-16 10:11  online_exam.gitCOMMIT_EDITMSG

     文件        330  2019-06-01 20:22  online_exam.gitconfig

     文件         73  2019-06-01 20:21  online_exam.gitdescription

     文件        101  2019-06-16 10:12  online_exam.gitFETCH_HEAD

     文件         23  2019-06-01 20:22  online_exam.gitHEAD

     文件        478  2019-06-01 20:21  online_exam.githooksapplypatch-msg.sample

     文件        896  2019-06-01 20:21  online_exam.githookscommit-msg.sample

     文件       3327  2019-06-01 20:21  online_exam.githooksfsmonitor-watchman.sample

     文件        189  2019-06-01 20:21  online_exam.githookspost-update.sample

     文件        424  2019-06-01 20:21  online_exam.githookspre-applypatch.sample

     文件       1638  2019-06-01 20:21  online_exam.githookspre-commit.sample

     文件       1348  2019-06-01 20:21  online_exam.githookspre-push.sample

     文件       4898  2019-06-01 20:21  online_exam.githookspre-rebase.sample

     文件        544  2019-06-01 20:21  online_exam.githookspre-receive.sample

     文件       1492  2019-06-01 20:21  online_exam.githooksprepare-commit-msg.sample

     文件       3610  2019-06-01 20:21  online_exam.githooksupdate.sample

     文件     297216  2019-06-16 10:11  online_exam.gitindex

     文件        240  2019-06-01 20:21  online_exam.gitinfoexclude

     文件       2599  2019-06-16 10:11  online_exam.gitlogsHEAD

     文件       2599  2019-06-16 10:11  online_exam.gitlogs
efsheadsmaster

     文件        209  2019-06-01 20:22  online_exam.gitlogs
efs
emotesoriginHEAD

     文件       2184  2019-06-16 10:11  online_exam.gitlogs
efs
emotesoriginmaster

     文件        208  2019-06-06 21:59  online_exam.gitobjects483c0c99d9cb01ffa24e67cf6d8954c756cc690

     文件         48  2019-06-02 11:20  online_exam.gitobjects66c982939277a12334dd1014e2206be76b93d15

     文件        437  2019-06-02 13:28  online_exam.gitobjects6e3b4c8dc876413be295a095111fe3e5b07bcfb

     文件        260  2019-06-06 21:59  online_exam.gitobjects73f7888e8bcf00f13af9120c6841583cde873f

     文件        183  2019-06-12 13:19  online_exam.gitobjectsa97c8eff782982a20e1e8714b882b0d3336b915

     文件       2264  2019-06-06 21:59  online_exam.gitobjectsa882e8aaa4ca39215260cb9107c05d967a3536

     文件        179  2019-06-06 21:59  online_exam.gitobjectsc7fd9ffb8a5c8908ff92ff9f2977cebb5db05be

     文件        212  2019-06-06 21:59  online_exam.gitobjectsd87ad30d8798d92b4f1aba7ba6bb6e7bbe0b14c

............此处省略2871个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)