Ejemplo n.º 1
0
 /**
  * @describe 加入收藏夹
  * @param map 类型 ActionMapping
  * @param form 类型 ActionForm
  * @param request 类型 HttpServletRequest
  * @param response 类型 HttpServletResponse
  * @return 类型 ActionForward
  */
 public ActionForward addCollection(
     ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   UserInfo ui = (UserInfo) request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION);
   String userkey = ui.getUserName();
   String postsid = request.getParameter("postid");
   dto.set("username", userkey);
   dto.set("postsid", postsid);
   postOper.addCollection(dto);
   return new ActionForward("/forum/postQuery.do?method=toMySavePostList");
 }
Ejemplo n.º 2
0
 /**
  * @describe 发表帖子
  * @param map 类型 ActionMapping
  * @param form 类型 ActionForm
  * @param request 类型 HttpServletRequest
  * @param response 类型 HttpServletResponse
  * @return 类型 ActionForward
  */
 public ActionForward sendPosts(
     ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   String itemid = request.getParameter("itemid");
   if (request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION) == null) {
     return new ActionForward("/forum/userOper/register.do?method=toLogin");
   }
   UserInfo ui = (UserInfo) request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION);
   String userkey = ui.getUserName();
   String ipfrom = request.getRemoteAddr();
   dto.set("itemid", itemid);
   dto.set("userkey", userkey);
   dto.set("ipfrom", ipfrom);
   postOper.sendPosts(dto);
   return new ActionForward("/forum/forumList.do?method=toPostList&itemid=" + itemid);
 }
 /** @describe 前台模块查询列表 */
 public ActionForward toForumList(
     ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   DynaActionFormDTO dto = (DynaActionFormDTO) form;
   String moduleId = (String) request.getParameter("moduleId");
   UserInfo ui = (UserInfo) request.getSession().getAttribute(SysStaticParameter.USER_IN_SESSION);
   // 用户列表,在线人数
   String userId = "GUEST";
   int forumUserCount = 0;
   if (ui != null) {
     userId = ui.getUserName();
   }
   System.out.println(userId);
   try {
     if (!userId.equals("GUEST")) {
       UserList.setUser(userId, 1);
     }
     forumUserCount = UserList.getCount(0);
     request.setAttribute("forumUserCount", new Integer(forumUserCount));
   } catch (RuntimeException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   }
   List userList = new ArrayList();
   userList = UserList.getUsers(1);
   request.setAttribute("userList", userList);
   // 模块列表
   HashMap hashmap = new HashMap();
   try {
     hashmap = forumListService.moduleQuery(moduleId);
   } catch (RuntimeException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   request.setAttribute("hashmap", hashmap);
   return map.findForward("list");
 }