@RequestMapping(value = "comparingSubmit", method = RequestMethod.POST) public void comparingSubmit( Model model, HttpServletRequest request, HttpServletResponse response, String test_no) { TestCompare compare = new TestCompare(); User u = (User) request.getSession().getAttribute("user"); if (u != null) { compare.setUser_id(u.getId()); } compare.setId(testCompareService.getTableId("test_compare")); if (request.getParameter("reaction_choice") != "" && request.getParameter("reaction_choice") != null) compare.setReaction_choice( Integer.parseInt((String) request.getParameter("reaction_choice"))); compare.setReaction_time(request.getParameter("reaction_time")); compare.setTest_no(Integer.parseInt((String) request.getParameter("test_no"))); Integer question_no = Integer.parseInt((String) request.getParameter("question_no")); compare.setQuestion_no(question_no); compare.setCorrect_answer(Integer.parseInt((String) request.getParameter("correct_answer"))); if ("true".equals(request.getParameter("is_true"))) { compare.setIs_true(true); } else { compare.setIs_true(false); } compare.setStudent_answer(Integer.parseInt((String) request.getParameter("student_answer"))); List<Map<String, Object>> l = testCompareService.executeQuery( "select * from test_compare where user_id=? and question_no=?", u.getId(), question_no); if (l.size() == 0) testCompareService.save(compare); }
@RequestMapping("copyright") public String copyright(HttpServletRequest request) { User user = (User) request.getSession().getAttribute("user"); if (user != null && user.getZuotijindu() != null && user.getZuotijindu() > 0) { return "redirect:/user/mokuai"; } return "copyright"; }
@RequestMapping(value = "index", method = RequestMethod.GET) public String login(Model model, HttpServletRequest request, HttpServletResponse response) { User user = (User) request.getSession().getAttribute("user"); // System.out.println("user: "******"user", user); user.setCreateTime(new Timestamp(System.currentTimeMillis())); String username = user.getUsername(); System.out.println("username="******"7")) { return "regstart_cr"; } return "regstart"; }