• 大小: 2.73MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-04
  • 语言: 其他
  • 标签: SSM  Forum  Web  

资源简介

该Forum系统是基于Spring+SpringMVC+Mybatis实现的,是一个值得学习的源码。

资源截图

代码片段和文件信息

package Controller;

import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.Board;
import model.Category;
import model.Person;
import model.Thread;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import util.Pagination;
import Service.BoardService;
import Service.CategoryService;
import Service.PersonService;
import Service.ThreadService;

@Controller
public class BoardController {

@Autowired
private BoardService boardService;
@Autowired
private ThreadService threadService;
@Autowired
private PersonService personService;
@Autowired
private CategoryService categoryService;

@RequestMapping(“board_list.do“)
public ModelAndView list(HttpServletRequest request HttpServletResponse response){
Board board =boardService.selectBoardById(Integer.parseInt(request.getParameter(“id“)));
request.setAttribute(“title“ “帖子列表 - 版面:“ + board.getName());
int totalCount=threadService.getCountByBoardId(board.getId());
Pagination pagination = new Pagination(request response);
pagination.setRecordCount(totalCount);
List threadList = threadService.list(board.getId()
new RowBounds(pagination.getFirstResult() pagination.getPageSize()));
request.setAttribute(“board“ board);
request.setAttribute(“pagination“ pagination);
request.setAttribute(“threadList“ threadList);
return new ModelAndView(“thread/listThread“);
}

@RequestMapping(“board_initSetAdmin.do“)
public ModelAndView initSetAdmin(HttpServletRequest request){
Board board =boardService.selectBoardById(Integer.parseInt(request.getParameter(“id“)));
request.setAttribute(“title“ “设置管理员 - 版面:“ + board.getName());
List personList = personService.selectAll();
int[] adminId = new int[board.getAdministrators().size()];
int i = 0;
for (Iterator it = board.getAdministrators().iterator(); it.hasNext(); i++) {
Person p = it.next();
adminId[i] = p.getId();
}
board.setAdminId(adminId);
request.setAttribute(“board“ board);
request.setAttribute(“personList“ personList);
return new ModelAndView(“board/setAdmin“);
}

@RequestMapping(“board_setAdmin.do“)
public ModelAndView setAdmin(@ModelAttribute Board board HttpServletRequest request){
int boardId=Integer.parseInt(request.getParameter(“id“));
Board board1 =boardService.selectBoardById(boardId);
personService.deleteByBoardId(board1.getId());
request.setAttribute(“title“ “设置管理员 - 版面:“ + board1.getName());
int[] adminId =board.getAdminId();
for (int i = 0; adminId != null && i < admin

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

     文件       1380  2017-02-09 20:44  Forum_SSM\.classpath

     文件       1400  2017-02-10 10:57  Forum_SSM\.project

     文件        522  2017-02-09 20:41  Forum_SSM\.settings\.jsdtscope

     文件        145  2017-02-09 20:44  Forum_SSM\.settings\com.genuitec.runtime.libraries.xml

     文件        364  2017-02-09 20:41  Forum_SSM\.settings\org.eclipse.jdt.core.prefs

     文件        486  2017-02-10 10:57  Forum_SSM\.settings\org.eclipse.wst.common.component

     文件        588  2017-02-09 20:44  Forum_SSM\.settings\org.eclipse.wst.common.project.facet.core.prefs.xml

     文件        462  2017-02-09 20:44  Forum_SSM\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2017-02-09 20:41  Forum_SSM\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2017-02-09 20:41  Forum_SSM\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件        458  2017-02-09 20:44  Forum_SSM\.springBeans

     文件       3145  2017-02-21 17:44  Forum_SSM\src\applicationContext.xml

     文件       3886  2017-02-18 15:12  Forum_SSM\src\Controller\BoardController.java

     文件       1518  2017-02-15 20:18  Forum_SSM\src\Controller\CategoryController.java

     文件       3892  2017-02-21 20:39  Forum_SSM\src\Controller\PersonController.java

     文件       2206  2017-02-19 09:44  Forum_SSM\src\Controller\ReplyController.java

     文件       3248  2017-02-18 19:14  Forum_SSM\src\Controller\ThreadController.java

     文件        244  2017-02-18 21:48  Forum_SSM\src\DAO\BoardDAO.java

     文件        268  2017-02-17 10:28  Forum_SSM\src\DAO\CategoryDAO.java

     文件        589  2017-02-21 19:15  Forum_SSM\src\DAO\PersonDAO.java

     文件        283  2017-02-19 09:41  Forum_SSM\src\DAO\ReplyDAO.java

     文件        551  2017-02-19 09:33  Forum_SSM\src\DAO\ThreadDAO.java

     文件        754  2017-02-18 21:51  Forum_SSM\src\DAOImpl\BoardDAOImpl.java

     文件        771  2017-02-17 10:28  Forum_SSM\src\DAOImpl\CategoryDAOImpl.java

     文件       1379  2017-02-17 09:07  Forum_SSM\src\DAOImpl\PersonDAOImpl.java

     文件        719  2017-02-19 09:45  Forum_SSM\src\DAOImpl\ReplyDAOImpl.java

     文件       1317  2017-02-19 09:33  Forum_SSM\src\DAOImpl\ThreadDAOImpl.java

     文件        799  2017-02-12 09:42  Forum_SSM\src\exception\ForumExceptionHandler.java

     文件       1057  2016-09-27 15:38  Forum_SSM\src\filter\CharacterEncodingFilter.java

     文件       1280  2017-02-21 17:39  Forum_SSM\src\generatorConfig.xml

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

评论

共有 条评论