Exemplo n.º 1
0
  @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
  public ModelAndView main(
      Product product, PageParameter page, ModelMap model, HttpSession httpSession) {
    User user =
        httpSession.getAttribute("user") != null ? (User) httpSession.getAttribute("user") : null;

    //		if(httpSession.getAttribute("resTopList")==null){
    JSONArray toplist = JSONArray.fromObject(mainService.getResource(user, "top"));
    JSONArray leftlist = JSONArray.fromObject(mainService.getResource(user, "left"));
    httpSession.setAttribute("resTopList", toplist);
    httpSession.setAttribute("resList", leftlist);
    //		}
    Notice notice = new Notice();

    try {
      model.addAttribute("notices", noticeService.getNotices(notice, page));
    } catch (DaoException e) {
      logger.error("", e);
    }
    User us = new User();
    us.setUserId(user.getUserId());
    User u = (User) userDao.getUser(us);
    model.addAttribute("userbean", u);

    return new ModelAndView("main.jsp");
  }
Exemplo n.º 2
0
 public void validate(Object arg0, Errors arg1) {
   User user = (User) arg0;
   ValidationUtils.rejectIfEmptyOrWhitespace(
       arg1, "userName", "user.userName.required", "用户名必须填写");
   ValidationUtils.rejectIfEmptyOrWhitespace(arg1, "userPas", "user.userPas.required", "密码不能为空");
   validateEmail(user.getUserEmail(), arg1);
 }
Exemplo n.º 3
0
  @RequestMapping("/getIndexEvents")
  public @ResponseBody Map<String, Object> getIndexEvents(
      Event event, Concern concern, PageParameter page, ModelMap model, HttpSession httpSession) {
    Map<String, Object> map = new HashMap<String, Object>();
    try {
      if (concern != null && StringUtils.isNotBlank(concern.getConcernType())) {
        User user = this.getSessionUser(httpSession);
        //				User user =
        // httpSession.getAttribute("user")!=null?(User)httpSession.getAttribute("user"):null;

        concern.setUserId(user.getUserId());
        map.put("objs", eventService.getConcernPage(concern, page));
      } else {
        map.put("objs", eventService.getPage(event, page));
      }
      map.put("page", page);

    } catch (DaoException e) {
      logger.error("查询活动分页错误", e);
    }
    return map;
  }