├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.core.resources.prefs ├── org.eclipse.mylyn.tasks.ui.prefs ├── org.eclipse.wst.ws.service.policy.prefs ├── org.eclipse.ltk.core.refactoring.prefs ├── org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.common.component ├── .jsdtscope ├── org.eclipse.jdt.core.prefs └── org.eclipse.wst.validation.prefs ├── .DS_Store ├── src ├── .DS_Store ├── com │ └── csdn │ │ ├── exception │ │ ├── NotLoginException.java │ │ └── UserExistException.java │ │ ├── dao │ │ ├── LoginLogDao.java │ │ ├── BoardDao.java │ │ ├── PostDao.java │ │ ├── UserDao.java │ │ ├── TopicDao.java │ │ ├── Page.java │ │ └── BaseDao.java │ │ ├── domain │ │ ├── BaseDomain.java │ │ ├── Board.hbm.xml │ │ ├── hbm │ │ │ ├── Board.hbm.xml │ │ │ ├── LoginLog.hbm.xml │ │ │ ├── Post.hbm.xml │ │ │ ├── User.hbm.xml │ │ │ └── Topic.hbm.xml │ │ ├── LoginLog.hbm.xml │ │ ├── Post.hbm.xml │ │ ├── User.hbm.xml │ │ ├── Topic.hbm.xml │ │ ├── MainPost.java │ │ ├── LoginLog.java │ │ ├── Board.java │ │ ├── Post.java │ │ ├── Topic.java │ │ └── User.java │ │ ├── cons │ │ └── CommonConstant.java │ │ ├── web │ │ ├── ForumHandlerExceptionResolver.java │ │ ├── BaseController.java │ │ ├── RegisterController.java │ │ ├── LoginController.java │ │ ├── ForumFilter.java │ │ ├── ForumManageController.java │ │ └── BoardManageController.java │ │ └── service │ │ ├── UserService.java │ │ └── ForumService.java ├── log4j.properties ├── jdbc.properties ├── applicationContext.xml ├── baobaotao-service.xml ├── ehcache.xml └── baobaotao-dao.xml ├── WebContent ├── META-INF │ └── MANIFEST.MF ├── .DS_Store ├── static │ ├── .DS_Store │ ├── css │ │ ├── bg.png │ │ ├── textspan.css │ │ ├── normalize.css │ │ ├── style.css │ │ ├── other.css │ │ ├── board.css │ │ └── board2.css │ ├── scss │ │ ├── bg.png │ │ └── style.scss │ ├── images │ │ ├── bg.png │ │ ├── sign.jpg │ │ ├── banner.jpg │ │ └── footer_img.jpg │ └── js │ │ ├── index.js │ │ └── prefixfree.min.js ├── WEB-INF │ ├── .DS_Store │ ├── lib │ │ ├── log4j.jar │ │ ├── javaee.jar │ │ ├── ojdbc6.jar │ │ ├── hibernate3.jar │ │ ├── jstl-1.2.jar │ │ ├── antlr-2.7.6.jar │ │ ├── commons-dbcp.jar │ │ ├── dom4j-1.6.1.jar │ │ ├── aopalliance-1.0.jar │ │ ├── ehcache-1.6.2.jar │ │ ├── slf4j-api-1.7.7.jar │ │ ├── cglib-nodep-2.2.2.jar │ │ ├── commons-beanutils.jar │ │ ├── commons-digester.jar │ │ ├── commons-lang-2.4.jar │ │ ├── javax.persistence.jar │ │ ├── javax.transaction.jar │ │ ├── spring-hibernate3.jar │ │ ├── aspectjweaver-1.7.1.jar │ │ ├── commons-pool-1.5.4.jar │ │ ├── javassist-3.15.0-GA.jar │ │ ├── slf4j-log4j12-1.6.1.jar │ │ ├── commons-logging-1.1.1.jar │ │ ├── commons-collections-3.2.1.jar │ │ ├── commons-fileupload-1.2.2.jar │ │ ├── commons-validator-1.5.1.jar │ │ ├── hibernate-annotations-3.4.0.jar │ │ ├── hibernate-commons-annotations.jar │ │ ├── mysql-connector-java-5.1.6-bin.jar │ │ ├── org.springframework.transaction.jar │ │ ├── org.springframework.aop-3.1.0.RELEASE.jar │ │ ├── org.springframework.asm-3.1.0.RELEASE.jar │ │ ├── org.springframework.orm-3.1.0.RELEASE.jar │ │ ├── org.springframework.web-3.1.0.RELEASE.jar │ │ ├── org.springframework.beans-3.1.0.RELEASE.jar │ │ ├── org.springframework.core-3.1.0.RELEASE.jar │ │ ├── org.springframework.jdbc-3.1.0.RELEASE.jar │ │ ├── org.springframework.aspects-3.1.0.RELEASE.jar │ │ ├── org.springframework.context-3.1.0.RELEASE.jar │ │ ├── org.springframework.expression-3.1.0.RELEASE.jar │ │ ├── org.springframework.web.servlet-3.1.0.RELEASE.jar │ │ └── org.springframework.context.support-3.1.0.RELEASE.jar │ ├── jsp │ │ ├── switch.jsp │ │ ├── fail.jsp │ │ ├── success.jsp │ │ ├── addBoardSuccess.jsp │ │ ├── includeTop.jsp │ │ ├── userLockManage.jsp │ │ ├── setBoardManager.jsp │ │ ├── listTopicPosts.jsp │ │ ├── addBoard.jsp │ │ ├── addTopic.jsp │ │ ├── listAllBoards.jsp │ │ └── listBoardTopics.jsp │ ├── baobaotao-servlet.xml │ ├── tags │ │ └── PageBar.tag │ └── web.xml ├── index.jsp ├── login_refresh.jsp ├── login.jsp └── register.jsp ├── .classpath ├── .project └── README.md /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/.DS_Store -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/src/.DS_Store -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebContent/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/.DS_Store -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /WebContent/static/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/.DS_Store -------------------------------------------------------------------------------- /WebContent/WEB-INF/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/.DS_Store -------------------------------------------------------------------------------- /WebContent/static/css/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/css/bg.png -------------------------------------------------------------------------------- /WebContent/static/scss/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/scss/bg.png -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/log4j.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/log4j.jar -------------------------------------------------------------------------------- /WebContent/static/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/images/bg.png -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//WebContent/login.jsp=UTF-8 3 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/javaee.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/javaee.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/ojdbc6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/ojdbc6.jar -------------------------------------------------------------------------------- /WebContent/static/images/sign.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/images/sign.jpg -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/hibernate3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/hibernate3.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/jstl-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/jstl-1.2.jar -------------------------------------------------------------------------------- /WebContent/static/images/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/images/banner.jpg -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/antlr-2.7.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/antlr-2.7.6.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-dbcp.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-dbcp.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /WebContent/static/images/footer_img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/static/images/footer_img.jpg -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/aopalliance-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/aopalliance-1.0.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/ehcache-1.6.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/ehcache-1.6.2.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/slf4j-api-1.7.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/slf4j-api-1.7.7.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/cglib-nodep-2.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/cglib-nodep-2.2.2.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-beanutils.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-beanutils.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-digester.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-digester.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-lang-2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-lang-2.4.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/javax.persistence.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/javax.persistence.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/javax.transaction.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/javax.transaction.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/spring-hibernate3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/spring-hibernate3.jar -------------------------------------------------------------------------------- /.settings/org.eclipse.mylyn.tasks.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | project.repository.kind=local 3 | project.repository.url=local 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.ws.service.policy.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.wst.ws.service.policy.projectEnabled=false 3 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/aspectjweaver-1.7.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/aspectjweaver-1.7.1.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-pool-1.5.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-pool-1.5.4.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/javassist-3.15.0-GA.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/javassist-3.15.0-GA.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/slf4j-log4j12-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/slf4j-log4j12-1.6.1.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-logging-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-collections-3.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-collections-3.2.1.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-fileupload-1.2.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-fileupload-1.2.2.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/commons-validator-1.5.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/commons-validator-1.5.1.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/hibernate-annotations-3.4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/hibernate-annotations-3.4.0.jar -------------------------------------------------------------------------------- /src/com/csdn/exception/NotLoginException.java: -------------------------------------------------------------------------------- 1 | package com.csdn.exception; 2 | 3 | public class NotLoginException extends RuntimeException{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/hibernate-commons-annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/hibernate-commons-annotations.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/mysql-connector-java-5.1.6-bin.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.transaction.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.transaction.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.aop-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.aop-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.asm-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.asm-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.orm-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.orm-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.web-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.web-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.beans-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.beans-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.core-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.core-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.jdbc-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.jdbc-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.aspects-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.aspects-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.context-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.context-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /.settings/org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs: -------------------------------------------------------------------------------- 1 | XDOCLETBUILDERACTIVE=true 2 | XDOCLETHOME= 3 | XDOCLETUSEGLOBAL=true 4 | XDOCLETVERSION=1.2.1 5 | eclipse.preferences.version=1 6 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.expression-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.expression-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.web.servlet-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.web.servlet-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/org.springframework.context.support-3.1.0.RELEASE.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/czxapple/CSDN/HEAD/WebContent/WEB-INF/lib/org.springframework.context.support-3.1.0.RELEASE.jar -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/switch.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | -------------------------------------------------------------------------------- /src/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO,A1 2 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 3 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.A1.layout.ConversionPattern=%d %5p [%t] (%F:%L) - %m%n 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/com/csdn/exception/UserExistException.java: -------------------------------------------------------------------------------- 1 | package com.csdn.exception; 2 | 3 | public class UserExistException extends Exception 4 | { 5 | public UserExistException(String errorMsg) 6 | { 7 | super(errorMsg); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /WebContent/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | -------------------------------------------------------------------------------- /WebContent/login_refresh.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 7 | 8 | -------------------------------------------------------------------------------- /src/jdbc.properties: -------------------------------------------------------------------------------- 1 | #Mysql - linkx 2 | jdbc.driverClassName=com.mysql.jdbc.Driver 3 | jdbc.url=jdbc:mysql://10.211.55.4:3306/sampledb17?useUnicode=true&characterEncoding=UTF-8 4 | jdbc.username=root 5 | jdbc.password=adore 6 | ##oracle 7 | #jdbc.driverClassName=oracle.jdbc.driver.OracleDriver 8 | #jdbc.url=jdbc:oracle:thin:@localhost:1521:ora9i 9 | #jdbc.username=stamen 10 | #jdbc.password=abc -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/com/csdn/dao/LoginLogDao.java: -------------------------------------------------------------------------------- 1 | //package com.csdn.dao; 2 | // 3 | //import org.springframework.stereotype.Repository; 4 | // 5 | //import com.csdn.domain.LoginLog; 6 | // 7 | // 8 | // 9 | ///** 10 | // * Post的DAO类 11 | // * 12 | // */ 13 | //@Repository 14 | //public class LoginLogDao extends BaseDao { 15 | // public void save(LoginLog loginLog) { 16 | // this.getHibernateTemplate().save(loginLog); 17 | // } 18 | // 19 | //} 20 | -------------------------------------------------------------------------------- /src/com/csdn/domain/BaseDomain.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import java.io.Serializable; 4 | 5 | import org.apache.commons.lang.builder.ToStringBuilder; 6 | 7 | /** 8 | * 9 | *
类描述: 10 | *
所示PO的父类
11 | *@see 12 | *@since 13 | */ 14 | public class BaseDomain implements Serializable 15 | { 16 | public String toString() { 17 | return ToStringBuilder.reflectionToString(this); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/fail.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 操作失败 8 | 9 | 10 | 操作失败!错误信息:${errorMsg} 11 |
12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/com/csdn/dao/BoardDao.java: -------------------------------------------------------------------------------- 1 | package com.csdn.dao; 2 | 3 | import java.util.Iterator; 4 | 5 | import org.springframework.stereotype.Repository; 6 | 7 | import com.csdn.domain.Board; 8 | 9 | @Repository("boardDao") 10 | public class BoardDao extends BaseDao{ 11 | protected final String GET_BOARD_NUM = "select count(f.boardId) from Board f"; 12 | 13 | public long getBoardNum() { 14 | Iterator iter = getHibernateTemplate().iterate(GET_BOARD_NUM); 15 | return ((Long)iter.next()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/com/csdn/cons/CommonConstant.java: -------------------------------------------------------------------------------- 1 | package com.csdn.cons; 2 | 3 | /** 4 | *整个应用通用的常量 5 | *
类描述: 6 | *
|
7 | *@see 8 | *@since 9 | */ 10 | public class CommonConstant 11 | { 12 | /** 13 | * 用户对象放到Session中的键名称 14 | */ 15 | public static final String USER_CONTEXT = "USER_CONTEXT"; 16 | 17 | /** 18 | * 将登录前的URL放到Session中的键名称 19 | */ 20 | public static final String LOGIN_TO_URL = "toUrl"; 21 | 22 | /** 23 | * 每页的记录数 24 | */ 25 | public static final int PAGE_SIZE = 5; 26 | } 27 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/success.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 操作成功 9 | 12 | 13 | 操作成功! 14 | 15 | 16 | -------------------------------------------------------------------------------- /WebContent/static/js/index.js: -------------------------------------------------------------------------------- 1 | var working = false; 2 | $('.login').on('submit', function(e) { 3 | e.preventDefault(); 4 | if (working) return; 5 | working = true; 6 | var $this = $(this), 7 | $state = $this.find('button > .state'); 8 | $this.addClass('loading'); 9 | $state.html('Authenticating'); 10 | setTimeout(function() { 11 | $this.addClass('ok'); 12 | $state.html('Welcome back!'); 13 | setTimeout(function() { 14 | $state.html('Log in'); 15 | $this.removeClass('ok loading'); 16 | working = false; 17 | }, 4000); 18 | }, 3000); 19 | }); -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/addBoardSuccess.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 操作成功 9 | 10 | 11 | 操作成功!你希望 12 | <%-- ">再次添加 13 | 或者 --%> 14 | ">返回首页 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/com/csdn/domain/Board.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/com/csdn/domain/hbm/Board.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/com/csdn/domain/LoginLog.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/com/csdn/domain/hbm/LoginLog.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.7 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.7 13 | -------------------------------------------------------------------------------- /src/com/csdn/web/ForumHandlerExceptionResolver.java: -------------------------------------------------------------------------------- 1 | package com.csdn.web; 2 | 3 | import org.springframework.web.servlet.ModelAndView; 4 | import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; 5 | 6 | /** 7 | * 异常处理 8 | */ 9 | public class ForumHandlerExceptionResolver extends 10 | SimpleMappingExceptionResolver { 11 | protected ModelAndView doResolveException( 12 | javax.servlet.http.HttpServletRequest httpServletRequest, 13 | javax.servlet.http.HttpServletResponse httpServletResponse, 14 | java.lang.Object o, java.lang.Exception e) { 15 | httpServletRequest.setAttribute("ex", e); 16 | e.printStackTrace(); 17 | return super.doResolveException(httpServletRequest, 18 | httpServletResponse, o, e); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/com/csdn/dao/PostDao.java: -------------------------------------------------------------------------------- 1 | package com.csdn.dao; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | import com.csdn.domain.Post; 6 | 7 | 8 | 9 | /** 10 | * Post的DAO类 11 | * 12 | */ 13 | @Repository 14 | public class PostDao extends BaseDao { 15 | 16 | protected final String GET_PAGED_POSTS = "from Post where topic.topicId =? order by createTime desc"; 17 | 18 | protected final String DELETE_TOPIC_POSTS = "delete from Post where topic.topicId=?"; 19 | 20 | public Page getPagedPosts(int topicId, int pageNo, int pageSize) { 21 | return pagedQuery(GET_PAGED_POSTS,pageNo,pageSize,topicId); 22 | } 23 | 24 | /** 25 | * 删除主题下的所有帖子 26 | * @param topicId 主题ID 27 | */ 28 | public void deleteTopicPosts(int topicId) { 29 | getHibernateTemplate().bulkUpdate(DELETE_TOPIC_POSTS,topicId); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 18 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/com/csdn/domain/Post.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/com/csdn/domain/User.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/com/csdn/domain/hbm/Post.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/com/csdn/domain/hbm/User.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/com/csdn/domain/Topic.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/com/csdn/domain/hbm/Topic.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/com/csdn/domain/MainPost.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import javax.persistence.CascadeType; 4 | import javax.persistence.DiscriminatorColumn; 5 | import javax.persistence.DiscriminatorType; 6 | import javax.persistence.DiscriminatorValue; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Inheritance; 9 | import javax.persistence.InheritanceType; 10 | import javax.persistence.JoinColumn; 11 | import javax.persistence.ManyToOne; 12 | import javax.persistence.OneToOne; 13 | 14 | import org.hibernate.annotations.Cache; 15 | import org.hibernate.annotations.CacheConcurrencyStrategy; 16 | import org.springframework.cache.annotation.Cacheable; 17 | 18 | /** 19 | *
20 | * 类描述: 21 | * 22 | *
23 |  * 主题对应的主题帖
24 |  * 
25 | * 26 | * @see 27 | *@since 28 | */ 29 | @Entity 30 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 31 | @Inheritance(strategy = InheritanceType.SINGLE_TABLE) 32 | @DiscriminatorColumn(name = "post_type", discriminatorType = DiscriminatorType.STRING) 33 | @DiscriminatorValue("2") 34 | public class MainPost extends Post { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CSDN 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jem.workbench.JavaEMFNature 31 | org.eclipse.wst.common.modulecore.ModuleCoreNature 32 | org.eclipse.wst.common.project.facet.core.nature 33 | org.eclipse.jdt.core.javanature 34 | org.eclipse.wst.jsdt.core.jsNature 35 | 36 | 37 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | DELEGATES_PREFERENCE=delegateValidatorList 2 | USER_BUILD_PREFERENCE=enabledBuildValidatorList 3 | USER_MANUAL_PREFERENCE=enabledManualValidatorList 4 | USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.700.v201508251749 5 | eclipse.preferences.version=1 6 | override=true 7 | suspend=false 8 | vals/org.eclipse.jst.jsf.facelet.ui.FaceletHTMLValidator/global=FF01 9 | vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01 10 | vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01 11 | vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01 12 | vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01 13 | vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01 14 | vals/org.eclipse.wst.html.core.HTMLValidator/global=FF01 15 | vals/org.eclipse.wst.wsdl.validation.wsdl/global=FF02158org.eclipse.wst.wsdl.validation.internal.eclipse.Validator 16 | vals/org.eclipse.wst.xml.core.xml/global=FF03 17 | vals/org.eclipse.wst.xsd.core.xsd/global=FF02162org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator 18 | vals/org.eclipse.wst.xsl.core.xsl/global=FF02 19 | vf.version=3 20 | -------------------------------------------------------------------------------- /src/com/csdn/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.csdn.dao; 2 | import java.util.List; 3 | 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.csdn.domain.User; 7 | 8 | 9 | /** 10 | * User对象Dao 11 | */ 12 | @Repository 13 | public class UserDao extends BaseDao { 14 | private final String GET_USER_BY_USERNAME = "from User u where u.userName = ?"; 15 | 16 | private final String QUERY_USER_BY_USERNAME = "from User u where u.userName like ?"; 17 | 18 | /** 19 | * 根据用户名查询User对象 20 | * @param userName 用户名 21 | * @return 对应userName的User对象,如果不存在,返回null。 22 | */ 23 | public User getUserByUserName(String userName){ 24 | @SuppressWarnings("unchecked") 25 | List users = (List)getHibernateTemplate().find(GET_USER_BY_USERNAME,userName); 26 | if (users.size() == 0) { 27 | return null; 28 | }else{ 29 | return users.get(0); 30 | } 31 | } 32 | 33 | /** 34 | * 根据用户名为模糊查询条件,查询出所有前缀匹配的User对象 35 | * @param userName 用户名查询条件 36 | * @return 用户名前缀匹配的所有User对象 37 | */ 38 | public List queryUserByUserName(String userName){ 39 | return (List)getHibernateTemplate().find(QUERY_USER_BY_USERNAME,userName+"%"); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/com/csdn/web/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.csdn.web; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | import org.springframework.util.Assert; 6 | 7 | import com.csdn.cons.CommonConstant; 8 | import com.csdn.domain.User; 9 | 10 | 11 | /** 12 | * 13 | *
14 | * 类描述: 15 | * 16 | *
17 |  * 所有Controller的基类
18 |  * 
19 | * 20 | * @see 21 | * @since 22 | */ 23 | public class BaseController { 24 | protected static final String ERROR_MSG_KEY = "errorMsg"; 25 | 26 | /** 27 | * 获取保存在Session中的用户对象 28 | * 29 | * @param request 30 | * @return 31 | */ 32 | protected User getSessionUser(HttpServletRequest request) { 33 | return (User) request.getSession().getAttribute( 34 | CommonConstant.USER_CONTEXT); 35 | } 36 | 37 | /** 38 | * 保存用户对象到Session中 39 | * @param request 40 | * @param user 41 | */ 42 | protected void setSessionUser(HttpServletRequest request,User user) { 43 | request.getSession().setAttribute(CommonConstant.USER_CONTEXT, 44 | user); 45 | } 46 | 47 | 48 | /** 49 | * 获取基于应用程序的url绝对路径 50 | * 51 | * @param request 52 | * @param url 53 | * 以"/"打头的URL地址 54 | * @return 基于应用程序的url绝对路径 55 | */ 56 | public final String getAppbaseUrl(HttpServletRequest request, String url) { 57 | Assert.hasLength(url, "url不能为空"); 58 | Assert.isTrue(url.startsWith("/"), "必须以/打头"); 59 | return request.getContextPath() + url; 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/com/csdn/web/RegisterController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.csdn.web; 3 | 4 | import javax.servlet.http.HttpServletRequest; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | import org.springframework.web.servlet.ModelAndView; 11 | 12 | import com.csdn.domain.User; 13 | import com.csdn.exception.UserExistException; 14 | import com.csdn.service.UserService; 15 | 16 | 17 | /** 18 | * 19 | *
20 | * 类描述: 21 | * 22 | *
23 |  * 用户注册的Action
24 |  * 
25 | * 26 | * @see 27 | * @since 28 | */ 29 | @Controller 30 | public class RegisterController extends BaseController { 31 | /** 32 | * 自动注入 33 | */ 34 | @Autowired 35 | private UserService userService; 36 | 37 | 38 | 39 | /** 40 | * 用户登录 41 | * @param request 42 | * @param response 43 | * @param user 44 | * @return 45 | */ 46 | @RequestMapping(value = "/register", method = RequestMethod.POST) 47 | public ModelAndView register(HttpServletRequest request,User user){ 48 | ModelAndView view = new ModelAndView(); 49 | view.setViewName("/success"); 50 | try { 51 | userService.register(user); 52 | } catch (UserExistException e) { 53 | view.addObject("errorMsg", "用户名已经存在,请选择其它的名字。"); 54 | view.setViewName("forward:/register.jsp"); 55 | } 56 | setSessionUser(request,user); 57 | return view; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/com/csdn/dao/TopicDao.java: -------------------------------------------------------------------------------- 1 | package com.csdn.dao; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | import com.csdn.domain.Topic; 6 | 7 | 8 | 9 | /** 10 | * topic 的DAO类 11 | * 12 | */ 13 | @Repository 14 | public class TopicDao extends BaseDao { 15 | 16 | private final String GET_BOARD_DIGEST_TOPICS = "from Topic t where t.boardId = ? and digest > 0 order by t.lastPost desc,digest desc"; 17 | 18 | private final String GET_PAGED_TOPICS = "from Topic where boardId = ? order by lastPost desc"; 19 | 20 | private final String QUERY_TOPIC_BY_TITILE = "from Topic where topicTitle like ? order by lastPost desc"; 21 | 22 | /** 23 | * 获取论坛版块某一页的精华主题帖,按最后回复时间以及精华级别 降序排列 24 | * @param boardId 论坛版块ID 25 | * @return 该论坛下的所有精华主题帖 26 | */ 27 | public Page getBoardDigestTopics(int boardId,int pageNo,int pageSize){ 28 | return pagedQuery(GET_BOARD_DIGEST_TOPICS,pageNo,pageSize,boardId); 29 | } 30 | 31 | /** 32 | * 获取论坛版块分页的主题帖子 33 | * @param boardId 论坛版块ID 34 | * @param pageNo 页号,从1开始。 35 | * @param pageSize 每页的记录数 36 | * @return 包含分页信息的Page对象 37 | */ 38 | public Page getPagedTopics(int boardId,int pageNo,int pageSize) { 39 | return pagedQuery(GET_PAGED_TOPICS,pageNo,pageSize,boardId); 40 | } 41 | 42 | /** 43 | * 根据主题帖标题查询所有模糊匹配的主题帖 44 | * @param title 标题的查询条件 45 | * @param pageNo 页号,从1开始。 46 | * @param pageSize 每页的记录数 47 | * @return 包含分页信息的Page对象 48 | */ 49 | public Page queryTopicByTitle(String title, int pageNo, int pageSize) { 50 | return pagedQuery(QUERY_TOPIC_BY_TITILE,pageNo,pageSize,title); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/com/csdn/domain/LoginLog.java: -------------------------------------------------------------------------------- 1 | //package com.csdn.domain; 2 | // 3 | //import java.util.Date; 4 | // 5 | //import javax.persistence.Column; 6 | //import javax.persistence.Entity; 7 | //import javax.persistence.GeneratedValue; 8 | //import javax.persistence.GenerationType; 9 | //import javax.persistence.Id; 10 | //import javax.persistence.JoinColumn; 11 | //import javax.persistence.ManyToOne; 12 | //import javax.persistence.Table; 13 | // 14 | //import org.hibernate.annotations.Cache; 15 | //import org.hibernate.annotations.CacheConcurrencyStrategy; 16 | // 17 | // 18 | // 19 | //@Entity 20 | //@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 21 | //@Table(name = "t_login_log") 22 | //public class LoginLog extends BaseDomain { 23 | // @Id 24 | // @GeneratedValue(strategy = GenerationType.IDENTITY) 25 | // @Column(name = "login_log_id") 26 | // private int loginLogId; 27 | // 28 | // @Column(name = "login_datetime") 29 | // private Date loginDate; 30 | // 31 | // @ManyToOne 32 | // @JoinColumn(name = "user_id") 33 | // private User user; 34 | // 35 | // private String ip; 36 | // 37 | // 38 | // public int getLoginLogId() { 39 | // return loginLogId; 40 | // } 41 | // public void setLoginLogId(int loginLogId) { 42 | // this.loginLogId = loginLogId; 43 | // } 44 | // 45 | // public String getIp() { 46 | // return ip; 47 | // } 48 | // public void setIp(String ip) { 49 | // this.ip = ip; 50 | // } 51 | // public Date getLoginDate() { 52 | // return loginDate; 53 | // } 54 | // public void setLoginDate(Date loginDate) { 55 | // this.loginDate = loginDate; 56 | // } 57 | // public User getUser() { 58 | // return user; 59 | // } 60 | // public void setUser(User user) { 61 | // this.user = user; 62 | // } 63 | // 64 | //} 65 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/baobaotao-servlet.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | fail 33 | 34 | 35 | 36 | fail 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/tags/PageBar.tag: -------------------------------------------------------------------------------- 1 | <%@ tag pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | <%@ attribute name="pageUrl" required="true" rtexprvalue="true" 4 | description="分页页面对应的URl"%> 5 | <%@ attribute name="pageAttrKey" required="true" rtexprvalue="true" 6 | description="Page对象在Request域中的键名称"%> 7 | 8 | <% 9 | String separator = pageUrl.indexOf("?") > -1?"&":"?"; 10 | jspContext.setAttribute("pageResult", request.getAttribute(pageAttrKey)); 11 | jspContext.setAttribute("pageUrl", pageUrl); 12 | jspContext.setAttribute("separator", separator); 13 | %> 14 |
15 | 共${pageResult.totalPageCount}页,第${pageResult.currentPageNo}页 16 | 17 | 首页   18 | 19 | 20 | ${separator}pageNo=1">首页   21 | 22 | 23 | ${separator}pageNo=${pageResult.currentPageNo -1 }">上一页   25 | 26 | 27 | 上一页   28 | 29 | 30 | ${separator}pageNo=${pageResult.currentPageNo +1 }">下一页   32 | 33 | 34 | 下一页   35 | 36 | 37 | 末页   38 | 39 | 40 | ${separator}pageNo=${pageResult.totalPageCount }">末页   42 | 43 |
-------------------------------------------------------------------------------- /src/baobaotao-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/includeTop.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | <%-- ">首页 --%> 7 | 8 | <%-- 9 | ${USER_CONTEXT.userName}(${USER_CONTEXT.credit}),欢迎您的到来,">注销 ${USER_CONTEXT.userType} 11 | 12 |    13 | 14 | ">登录   15 | ">注册 16 | 17 | 18 | ">新建论坛版块   19 | ">论坛版块管理员   20 | ">用户锁定/解锁 21 | --%> 22 |
23 | ">首页 24 | 欢迎访问CSDN,请先 25 | 26 | ${USER_CONTEXT.userName}(${USER_CONTEXT.credit}),欢迎您的到来,">注销 ${USER_CONTEXT.userType} 28 | 29 |    30 | 31 | ">登录 或者  32 | ">注册 33 | 34 | 35 | ">新建论坛版块   36 | ">论坛版块管理员   37 | ">用户锁定/解锁 38 | 39 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 仿CSDN论坛项目 2 | ### 3 | >> 示例: 4 | 5 | 首页显示 6 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-01.png) 7 | 8 | 主题帖显示 9 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-02.png) 10 | 11 | 回复帖子显示 12 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-03.png) 13 | 14 | 登陆显示 15 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-04.png) 16 | 17 | 注册显示 18 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-05.png) 19 | 20 | 发表新帖显示 21 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-06.png) 22 | 23 | 创建新版块显示 24 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-07.png) 25 | 26 | 封号解封账号显示 27 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-08.png) 28 | 29 | 置顶精华帖和删除帖显示 30 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-09.png) 31 | 32 | >> 技术框架选择: 33 | 34 | 我们拟使用以下的技术框架完成论坛应用程序的开发. 35 | 36 | 为了解决中文乱码问题,我们在We层提供了一个字符编码转换过滤器。Web层使用Spring MVC 进行请求的处理和响应,视图层采用JSP2.0和JSTL技术. 37 | 服务层采用Spring3.0,而持久层的Hibernate通过Spring提供的技术支持类继承到Spring中系统严格采用Web层、服务层和持久层三层体系结构,上一层的程序可以调用下一层的程序,反之则不行,达到层与层之间松耦合的目的. 38 | 39 | 论坛系统技术框架图如下 40 | 41 | ![](https://github.com/czxapple/Resource/blob/master/CSDN-30.png) 42 | 43 | 44 | >> 功能模块组成: 45 | 46 | (一) 会员注册 新会员注册,提供会员信息,检验会员信息的有效性,并将会员信息持久化。  47 | 48 | (二) 会员登陆 提供用户凭证,验证用户信息,基于角色授权。 49 | 50 | (三) 会员管理 管理员由系统初始化分配一个,管理员可以对会员信息进行部分更改,整,版主调整,删除会员等。  51 | 52 | (四) 论坛板块管理 管理员可以添加、删除、调整、置顶、隐藏论坛板块 53 | 54 | (五) 帖子管理 6 管理员可以对所有帖子进行转移、置顶、删除等操作版主可以转移本板块帖子,也可以对本板块帖子进行置顶、删除等操作。 55 | 56 | (六)  帖子发表 注册用户可以在感兴趣的板块中发表新主题帖。  57 | 58 | (七) 帖子回复 用户可以对自己感兴趣的主题发表回复。 59 | 60 | (八) 帖子浏览 用户可以浏览所用可见帖子。  61 | 62 | (九) 帖子检索 用户可以提供标题关键字检索所有可见主题帖,注册用户可以查看自己回复的帖子。 63 | 64 | 65 | 66 | __Thanks__ ![][foryou] 67 | [foryou]:https://github.com/czxapple/Resource/blob/master/foryou.gif 68 | -------------------------------------------------------------------------------- /src/com/csdn/domain/Board.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import javax.persistence.CascadeType; 7 | import javax.persistence.Column; 8 | import javax.persistence.Entity; 9 | import javax.persistence.FetchType; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.GenerationType; 12 | import javax.persistence.Id; 13 | import javax.persistence.ManyToMany; 14 | import javax.persistence.Table; 15 | 16 | import org.hibernate.annotations.Cache; 17 | import org.hibernate.annotations.CacheConcurrencyStrategy; 18 | 19 | 20 | @Entity 21 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 22 | @Table(name = "t_board") 23 | public class Board extends BaseDomain { 24 | 25 | @Id 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) 27 | @Column(name = "board_id") 28 | private int boardId; 29 | 30 | @Column(name = "board_name") 31 | private String boardName; 32 | 33 | @Column(name = "board_desc") 34 | private String boardDesc; 35 | 36 | @Column(name = "topic_num") 37 | private int topicNum ; 38 | 39 | @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "manBoards", fetch = FetchType.LAZY) 40 | private Set users = new HashSet(); 41 | 42 | public int getTopicNum() { 43 | return topicNum; 44 | } 45 | 46 | public void setTopicNum(int topicNum) { 47 | this.topicNum = topicNum; 48 | } 49 | 50 | public String getBoardDesc() { 51 | return boardDesc; 52 | } 53 | 54 | public void setBoardDesc(String boardDesc) { 55 | this.boardDesc = boardDesc; 56 | } 57 | 58 | public int getBoardId() { 59 | return boardId; 60 | } 61 | 62 | public void setBoardId(int boardId) { 63 | this.boardId = boardId; 64 | } 65 | 66 | public String getBoardName() { 67 | return boardName; 68 | } 69 | 70 | public void setBoardName(String boardName) { 71 | this.boardName = boardName; 72 | } 73 | 74 | public Set getUsers() { 75 | return users; 76 | } 77 | 78 | public void setUsers(Set users) { 79 | this.users = users; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 29 | 30 | 33 | 34 | 36 | 39 | 40 | -------------------------------------------------------------------------------- /src/baobaotao-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 19 | 20 | 21 | 22 | com.csdn.domain 23 | 24 | 25 | 26 | 27 | 28 | org.hibernate.dialect.MySQLDialect 29 | 30 | true 31 | 32 | org.hibernate.cache.EhCacheProvider 33 | 34 | true 35 | 36 | 37 | 38 | 39 | nonstrict-read-write,fixedRegion 40 | nonstrict-read-write,freqChangeRegion 41 | read-write,freqChangeRegion 42 | read-write,freqChangeRegion 43 | 44 | 45 | 46 | 48 | -------------------------------------------------------------------------------- /src/com/csdn/web/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.csdn.web; 2 | 3 | import java.util.Date; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpSession; 7 | 8 | import org.apache.commons.lang.StringUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.servlet.ModelAndView; 13 | 14 | import com.csdn.cons.CommonConstant; 15 | import com.csdn.domain.User; 16 | import com.csdn.service.UserService; 17 | 18 | /** 19 | * 20 | *
21 | * 类描述: 22 | * 23 | *
24 |  *   论坛管理,这部分功能由论坛管理员操作,包括:创建论坛版块、指定论坛版块管理员、
25 |  * 用户锁定/解锁。
26 |  * 
27 | * 28 | * @see 29 | * @since 30 | */ 31 | @Controller 32 | @RequestMapping("/login") 33 | public class LoginController extends BaseController { 34 | /** 35 | * 自动注入 36 | */ 37 | @Autowired 38 | private UserService userService; 39 | 40 | /** 41 | * 用户登陆 42 | * @param request 43 | * @param user 44 | * @return 45 | */ 46 | @RequestMapping("/doLogin") 47 | public ModelAndView login(HttpServletRequest request, User user) { 48 | User dbUser = userService.getUserByUserName(user.getUserName()); 49 | ModelAndView mav = new ModelAndView(); 50 | mav.setViewName("forward:/login.jsp"); 51 | if (dbUser == null) { 52 | mav.addObject("errorMsg", "用户名不存在"); 53 | 54 | } else if (!dbUser.getPassword().equals(user.getPassword())) { 55 | mav.addObject("errorMsg", "用户密码不正确"); 56 | } else if (dbUser.getLocked() == User.USER_LOCK) { 57 | mav.addObject("errorMsg", "用户已经被锁定,不能登录。"); 58 | } else { 59 | dbUser.setLastIp(request.getRemoteAddr()); 60 | dbUser.setLastVisit(new Date()); 61 | userService.loginSuccess(dbUser); 62 | setSessionUser(request,dbUser); 63 | String toUrl = (String)request.getSession().getAttribute(CommonConstant.LOGIN_TO_URL); 64 | request.getSession().removeAttribute(CommonConstant.LOGIN_TO_URL); 65 | //如果当前会话中没有保存登录之前的请求URL,则直接跳转到主页 66 | if(StringUtils.isEmpty(toUrl)){ 67 | toUrl = "/index.html"; 68 | } 69 | mav.setViewName("redirect:"+toUrl); 70 | } 71 | return mav; 72 | } 73 | 74 | /** 75 | * 登录注销 76 | * @param session 77 | * @return 78 | */ 79 | @RequestMapping("/doLogout") 80 | public String logout(HttpSession session) { 81 | session.removeAttribute(CommonConstant.USER_CONTEXT); 82 | return "forward:/index.jsp"; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /WebContent/login.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 3 | 4 | 5 | 6 | Animated login form 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | <%-- 25 | 26 |
${errorMsg}
27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 |
用户名
密码
40 | 41 | 42 |
45 |
46 | --%> 47 | 48 | 49 |
50 | 51 |
${errorMsg}
52 |
53 | 64 | 67 |

68 |
69 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/com/csdn/dao/Page.java: -------------------------------------------------------------------------------- 1 | package com.csdn.dao; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | /** 8 | * 分页对象. 包含当前页数据及分页信息如总记录数. 9 | * 10 | */ 11 | public class Page implements Serializable { 12 | 13 | private static int DEFAULT_PAGE_SIZE = 20; 14 | 15 | private int pageSize = DEFAULT_PAGE_SIZE; // 每页的记录数 16 | 17 | private long start; // 当前页第一条数据在List中的位置,从0开始 18 | 19 | private List data; // 当前页中存放的记录,类型一般为List 20 | 21 | private long totalCount; // 总记录数 22 | 23 | /** 24 | * 构造方法,只构造空页. 25 | */ 26 | public Page() { 27 | this(0, 0, DEFAULT_PAGE_SIZE, new ArrayList()); 28 | } 29 | 30 | /** 31 | * 默认构造方法. 32 | * 33 | * @param start 本页数据在数据库中的起始位置 34 | * @param totalSize 数据库中总记录条数 35 | * @param pageSize 本页容量 36 | * @param data 本页包含的数据 37 | */ 38 | public Page(long start, long totalSize, int pageSize, List data) { 39 | this.pageSize = pageSize; 40 | this.start = start; 41 | this.totalCount = totalSize; 42 | this.data = data; 43 | } 44 | 45 | /** 46 | * 取总记录数. 47 | */ 48 | public long getTotalCount() { 49 | return this.totalCount; 50 | } 51 | 52 | /** 53 | * 取总页数. 54 | */ 55 | public long getTotalPageCount() { 56 | if (totalCount % pageSize == 0) 57 | return totalCount / pageSize; 58 | else 59 | return totalCount / pageSize + 1; 60 | } 61 | 62 | /** 63 | * 取每页数据容量. 64 | */ 65 | public int getPageSize() { 66 | return pageSize; 67 | } 68 | 69 | /** 70 | * 取当前页中的记录. 71 | */ 72 | public List getResult() { 73 | return data; 74 | } 75 | 76 | /** 77 | * 取该页当前页码,页码从1开始. 78 | */ 79 | public long getCurrentPageNo() { 80 | return start / pageSize + 1; 81 | } 82 | 83 | /** 84 | * 该页是否有下一页. 85 | */ 86 | public boolean isHasNextPage() { 87 | return this.getCurrentPageNo() < this.getTotalPageCount(); 88 | } 89 | 90 | /** 91 | * 该页是否有上一页. 92 | */ 93 | public boolean isHasPreviousPage() { 94 | return this.getCurrentPageNo() > 1; 95 | } 96 | 97 | /** 98 | * 获取任一页第一条数据在数据集的位置,每页条数使用默认值. 99 | * 100 | * @see #getStartOfPage(int,int) 101 | */ 102 | protected static int getStartOfPage(int pageNo) { 103 | return getStartOfPage(pageNo, DEFAULT_PAGE_SIZE); 104 | } 105 | 106 | /** 107 | * 获取任一页第一条数据在数据集的位置. 108 | * 109 | * @param pageNo 从1开始的页号 110 | * @param pageSize 每页记录条数 111 | * @return 该页第一条数据 112 | */ 113 | public static int getStartOfPage(int pageNo, int pageSize) { 114 | return (pageNo - 1) * pageSize; 115 | } 116 | } -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/userLockManage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 用户锁定及解锁 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <%@ include file="includeTop.jsp"%> 18 | 19 | 62 | 63 |
64 |
" 65 | method="post"> 66 | 67 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 82 | 84 | 85 |
用户
锁定/解锁锁定 79 | 解锁
86 |
87 |
88 | 89 | 90 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/setBoardManager.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 指定论坛版块管理员 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <%@ include file="includeTop.jsp"%> 18 | 19 | 62 | 63 | 64 | 65 |
66 |
" 67 | method="get"> 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 86 | 87 | 88 | 90 | 91 |
论坛模块
用户
92 |
93 |
94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/listTopicPosts.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> 5 | <%@taglib prefix="baobaotao" tagdir="/WEB-INF/tags"%> 6 | 7 | 8 | 9 | 10 | ${topic.topicTitle} 11 | 12 | 13 | 14 | <%@ include file="includeTop.jsp"%> 15 | 16 |
17 | 回复 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 |
${post.postTitle}
用户:${post.user.userName}
26 | 积分:${post.user.credit}
时间:
${post.postText}
32 | 35 | 36 | 58 |
" method="post" 59 | onsubmit="return mySubmit()"> 60 | 回复 61 |
62 | 63 | 64 | 65 | 66 | 68 | 69 | 70 | 71 | 73 | 74 | 75 | 79 | 80 |
标题
内容
76 |
81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /WebContent/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 9 | 用户注册 10 | 11 | 12 | 13 | 14 | 15 | 16 | 26 | 27 | 28 | 29 | 30 | 31 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | <%-- 73 | 74 | 75 | 用户注册信息: 76 |
" method="post" 77 | onsubmit="return mycheck()"> 78 | 79 |
${errorMsg}
80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 97 | 98 |
用户名
密码
密码确认
99 |
100 | --%> 101 | 102 | -------------------------------------------------------------------------------- /src/com/csdn/domain/Post.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.CascadeType; 6 | import javax.persistence.Column; 7 | import javax.persistence.DiscriminatorColumn; 8 | import javax.persistence.DiscriminatorType; 9 | import javax.persistence.DiscriminatorValue; 10 | import javax.persistence.Entity; 11 | import javax.persistence.GeneratedValue; 12 | import javax.persistence.GenerationType; 13 | import javax.persistence.Id; 14 | import javax.persistence.Inheritance; 15 | import javax.persistence.InheritanceType; 16 | import javax.persistence.JoinColumn; 17 | import javax.persistence.ManyToOne; 18 | import javax.persistence.Table; 19 | 20 | import org.hibernate.annotations.Cache; 21 | import org.hibernate.annotations.CacheConcurrencyStrategy; 22 | import org.springframework.cache.annotation.Cacheable; 23 | 24 | @Entity 25 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 26 | @Table(name = "t_post") 27 | @Inheritance(strategy = InheritanceType.SINGLE_TABLE) 28 | @DiscriminatorColumn(name = "post_type", discriminatorType = DiscriminatorType.STRING) 29 | @DiscriminatorValue("1") 30 | public class Post extends BaseDomain { 31 | 32 | @Id 33 | @GeneratedValue(strategy = GenerationType.IDENTITY) 34 | @Column(name = "post_id") 35 | private int postId; 36 | 37 | @Column(name = "post_title") 38 | private String postTitle; 39 | 40 | @Column(name = "post_text") 41 | private String postText; 42 | 43 | @Column(name = "board_id") 44 | private int boardId; 45 | 46 | @Column(name = "create_time") 47 | private Date createTime; 48 | 49 | @ManyToOne 50 | @JoinColumn(name = "user_id") 51 | private User user; 52 | 53 | @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} ) 54 | @JoinColumn(name="topic_id") 55 | private Topic topic; 56 | 57 | public Date getCreateTime() { 58 | return createTime; 59 | } 60 | 61 | public void setCreateTime(Date createTime) { 62 | this.createTime = createTime; 63 | } 64 | 65 | public int getBoardId() { 66 | return boardId; 67 | } 68 | 69 | public void setBoardId(int boardId) { 70 | this.boardId = boardId; 71 | } 72 | 73 | public int getPostId() { 74 | return postId; 75 | } 76 | 77 | public void setPostId(int postId) { 78 | this.postId = postId; 79 | } 80 | 81 | public String getPostText() { 82 | return postText; 83 | } 84 | 85 | public void setPostText(String postText) { 86 | this.postText = postText; 87 | } 88 | 89 | public String getPostTitle() { 90 | return postTitle; 91 | } 92 | 93 | public void setPostTitle(String postTitle) { 94 | this.postTitle = postTitle; 95 | } 96 | 97 | public Topic getTopic() { 98 | return topic; 99 | } 100 | 101 | public void setTopic(Topic topic) { 102 | this.topic = topic; 103 | } 104 | 105 | public User getUser() { 106 | return user; 107 | } 108 | 109 | public void setUser(User user) { 110 | this.user = user; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /src/com/csdn/web/ForumFilter.java: -------------------------------------------------------------------------------- 1 | package com.csdn.web; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Filter; 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | import javax.servlet.http.HttpServletRequest; 12 | 13 | import org.apache.commons.lang.StringUtils; 14 | import static com.csdn.cons.CommonConstant.*; 15 | import com.csdn.domain.User; 16 | 17 | public class ForumFilter implements Filter { 18 | private static final String FILTERED_REQUEST = "@@session_context_filtered_request"; 19 | // ① 不需要登录即可访问的URI资源 20 | private static final String[] INHERENT_ESCAPE_URIS = { "/index.jsp", 21 | "/index.html", "/login.jsp", "/login/doLogin.html", 22 | "/register.jsp", "/register.html", "/board/listBoardTopics-", 23 | "/board/listTopicPosts-" }; 24 | 25 | 26 | // ② 执行过滤 27 | public void doFilter(ServletRequest request, ServletResponse response, 28 | FilterChain chain) throws IOException, ServletException { 29 | 30 | // ②-1 保证该过滤器在一次请求中只被调用一次 31 | if (request != null && request.getAttribute(FILTERED_REQUEST) != null) { 32 | chain.doFilter(request, response); 33 | } else { 34 | 35 | // ②-2 设置过滤标识,防止一次请求多次过滤 36 | request.setAttribute(FILTERED_REQUEST, Boolean.TRUE); 37 | HttpServletRequest httpRequest = (HttpServletRequest) request; 38 | User userContext = getSessionUser(httpRequest); 39 | 40 | // ②-3 用户未登录, 且当前URI资源需要登录才能访问 41 | if (userContext == null 42 | && !isURILogin(httpRequest.getRequestURI(), httpRequest)) { 43 | String toUrl = httpRequest.getRequestURL().toString(); 44 | if (!StringUtils.isEmpty(httpRequest.getQueryString())) { 45 | toUrl += "?" + httpRequest.getQueryString(); 46 | } 47 | 48 | // ②-4将用户的请求URL保存在session中,用于登录成功之后,跳到目标URL 49 | //httpRequest.getSession().setAttribute(LOGIN_TO_URL,toUrl); 50 | httpRequest.getSession().setAttribute(LOGIN_TO_URL,toUrl); 51 | 52 | // ②-5转发到登录页面 53 | request.getRequestDispatcher("/index.jsp").forward(request, 54 | response); 55 | return; 56 | } 57 | chain.doFilter(request, response); 58 | } 59 | } 60 | 61 | @Override 62 | public void init(FilterConfig filterConfig) throws ServletException { 63 | 64 | } 65 | /** 66 | * 当前URI资源是否需要登录才能访问 67 | * @param requestURI 68 | * @param request 69 | * @return 70 | */ 71 | private boolean isURILogin(String requestURI, HttpServletRequest request) { 72 | if (request.getContextPath().equalsIgnoreCase(requestURI) 73 | || (request.getContextPath() + "/").equalsIgnoreCase(requestURI)) 74 | return true; 75 | for (String uri : INHERENT_ESCAPE_URIS) { 76 | if (requestURI != null && requestURI.indexOf(uri) >= 0) { 77 | return true; 78 | } 79 | } 80 | return false; 81 | } 82 | 83 | protected User getSessionUser(HttpServletRequest request) { 84 | return (User) request.getSession().getAttribute(USER_CONTEXT); 85 | } 86 | 87 | @Override 88 | public void destroy() { 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/com/csdn/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.csdn.service; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | //import com.csdn.dao.LoginLogDao; 10 | import com.csdn.dao.UserDao; 11 | //import com.csdn.domain.LoginLog; 12 | import com.csdn.domain.User; 13 | import com.csdn.exception.UserExistException; 14 | 15 | 16 | /** 17 | * 用户管理服务器,负责查询用户、注册用户、锁定用户等操作 18 | * 19 | */ 20 | @Service 21 | public class UserService { 22 | 23 | @Autowired 24 | private UserDao userDao; 25 | 26 | // @Autowired 27 | // private LoginLogDao loginLogDao; 28 | 29 | 30 | /** 31 | * 注册一个新用户,如果用户名已经存在此抛出UserExistException的异常 32 | * @param user 33 | */ 34 | public void register(User user) throws UserExistException{ 35 | User u = this.getUserByUserName(user.getUserName()); 36 | if(u != null){ 37 | throw new UserExistException("用户名已经存在"); 38 | }else{ 39 | user.setCredit(100); 40 | user.setUserType(1); 41 | userDao.save(user); 42 | } 43 | } 44 | 45 | /** 46 | * 更新用户 47 | * @param user 48 | */ 49 | public void update(User user){ 50 | userDao.update(user); 51 | } 52 | 53 | 54 | /** 55 | * 根据用户名/密码查询 User对象 56 | * @param userName 用户名 57 | * @return User 58 | */ 59 | public User getUserByUserName(String userName){ 60 | return userDao.getUserByUserName(userName); 61 | } 62 | 63 | 64 | /** 65 | * 根据userId加载User对象 66 | * @param userId 67 | * @return 68 | */ 69 | public User getUserById(int userId){ 70 | return userDao.get(userId); 71 | } 72 | 73 | /** 74 | * 将用户锁定,锁定的用户不能够登录 75 | * @param userName 锁定目标用户的用户名 76 | */ 77 | public void lockUser(String userName){ 78 | User user = userDao.getUserByUserName(userName); 79 | user.setLocked(User.USER_LOCK); 80 | userDao.update(user); 81 | } 82 | 83 | /** 84 | * 解除用户的锁定 85 | * @param userName 解除锁定目标用户的用户名 86 | */ 87 | public void unlockUser(String userName){ 88 | User user = userDao.getUserByUserName(userName); 89 | user.setLocked(User.USER_UNLOCK); 90 | userDao.update(user); 91 | } 92 | 93 | 94 | /** 95 | * 根据用户名为条件,执行模糊查询操作 96 | * @param userName 查询用户名 97 | * @return 所有用户名前导匹配的userName的用户 98 | */ 99 | public List queryUserByUserName(String userName){ 100 | return userDao.queryUserByUserName(userName); 101 | } 102 | 103 | /** 104 | * 获取所有用户 105 | * @return 所有用户 106 | */ 107 | public List getAllUsers(){ 108 | return userDao.loadAll(); 109 | } 110 | 111 | /** 112 | * 登陆成功 113 | * @param user 114 | */ 115 | public void loginSuccess(User user) { 116 | user.setCredit( 5 + user.getCredit()); 117 | // LoginLog loginLog = new LoginLog(); 118 | // loginLog.setUser(user); 119 | // loginLog.setIp(user.getLastIp()); 120 | // loginLog.setLoginDate(new Date()); 121 | userDao.update(user); 122 | // loginLogDao.save(loginLog); 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 宝宝淘论坛 4 | baobaotao 5 | 6 | contextConfigLocation 7 | classpath:/applicationContext.xml 8 | 9 | 10 | org.springframework.web.context.ContextLoaderListener 11 | 12 | 13 | hibernateFilter 14 | org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 15 | 16 | 17 | hibernateFilter 18 | *.jsp 19 | 20 | 21 | hibernateFilter 22 | *.html 23 | 24 | 25 | forumFilter 26 | com.csdn.web.ForumFilter 27 | 28 | 29 | forumFilter 30 | *.html 31 | 32 | 33 | forumFilter 34 | *.jsp 35 | 36 | 37 | encodingFilter 38 | org.springframework.web.filter.CharacterEncodingFilter 39 | 40 | encoding 41 | UTF-8 42 | 43 | 44 | forceEncoding 45 | true 46 | 47 | 48 | 49 | encodingFilter 50 | *.html 51 | 52 | 53 | encodingFilter 54 | *.jsp 55 | 56 | 57 | baobaotao 58 | org.springframework.web.servlet.DispatcherServlet 59 | 3 60 | 61 | 62 | baobaotao 63 | *.html 64 | 65 | 66 | default 67 | /static/* 68 | 69 | 70 | HiddenHttpMethodFilter 71 | org.springframework.web.filter.HiddenHttpMethodFilter 72 | 73 | 74 | HiddenHttpMethodFilter 75 | baobaotao 76 | 77 | 78 | index.jsp 79 | 80 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/addBoard.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 添加论坛版块 9 | 10 | 11 | 12 | 13 | 39 | 40 | 41 | <%@ include file="includeTop.jsp"%> 42 | 43 | 44 | 45 | 46 | 89 | 90 | 91 |
92 |
" method="post" 93 | onsubmit="return mySubmit()"> 94 | 95 | 96 | 97 | 99 | 100 | 101 | 102 | 104 | 105 | 106 | 109 | 110 |
版块名称
版块简介
111 |
112 |
113 | 114 | 115 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/addTopic.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 4 | 5 | 6 | 7 | 8 | 发表新话题 9 | 10 | 11 | 12 | 13 | 14 | 15 | 41 | 42 | 43 | <%@ include file="includeTop.jsp"%> 44 | 45 | 46 | 89 | 90 |
91 |
" method="post" 92 | onsubmit="return mySubmit()"> 93 | 94 | 95 | 96 | 99 | 100 | 101 | 103 | 104 | 105 | 108 | 109 |
标题 98 |
内容
106 |
110 |
111 |
112 | 113 | 114 | -------------------------------------------------------------------------------- /WebContent/static/css/textspan.css: -------------------------------------------------------------------------------- 1 | #recomBbsIndex { 2 | position: relative; 3 | float: left; 4 | width: 530px; 5 | padding: 15px 0 0 14px; 6 | } 7 | 8 | #recomBbsIndex h1 { 9 | height: 20px; 10 | background: none; 11 | padding: 0 0 4px 8px; 12 | line-height: 1.2; 13 | } 14 | 15 | #recomBbsIndex .list h3 { 16 | margin-top: 8px; 17 | } 18 | 19 | #recomBbsIndex .list h3 a:hover, #indexSidebar h3 a { 20 | color: #B50000; 21 | } 22 | 23 | #recomBbsIndex .list ul { 24 | padding: 0 10px; 25 | } 26 | 27 | #recomBbsIndex .list li { 28 | height: 30px; 29 | line-height: 30px; 30 | overflow: hidden; 31 | border-bottom: 1px dotted #DDD; 32 | } 33 | 34 | #recomBbsIndex .list .textSpan { 35 | float: left; 36 | width: 410px; 37 | height: 30px; 38 | overflow: hidden; 39 | } 40 | 41 | #recomBbsIndex .list .textSpan em { 42 | margin-left: 5px; 43 | } 44 | 45 | #recomBbsIndex .list .textSpan a { 46 | color: #222; 47 | float: left; 48 | max-width: 530px; 49 | } 50 | 51 | #recomBbsIndex .list .textSpan a:hover .red { 52 | text-decoration: underline; 53 | } 54 | 55 | #recomBbsIndex .list .textSpan a:hover, #recomBbsIndex .list .textSpan a:active, 56 | #indexSidebar .list a:hover, #indexSidebar .list a:active { 57 | color: #b50000; 58 | text-decoration: underline; 59 | background: none; 60 | } 61 | 62 | #recomBbsIndex .list .forum { 63 | float: right; 64 | color: #565656; 65 | width: 100px; 66 | height: 30px; 67 | overflow: hidden; 68 | text-align: right; 69 | } 70 | 71 | #indexSidebar { 72 | float: right; 73 | width: 250px; 74 | padding: 47px 15px 3000px; 75 | margin-bottom: -2980px; 76 | zoom: 1; 77 | border-left: 1px solid #c2c7ca; 78 | } 79 | 80 | #indexSidebar .title { 81 | height: 18px; 82 | border-bottom: 1px solid #d5d5d5; 83 | margin-bottom: 5px; 84 | } 85 | 86 | #indexSidebar .title a, #indexSidebar h4 { 87 | color: #b50000; 88 | font-size: 12px; 89 | } 90 | 91 | #indexSidebar .list { 92 | overflow: hidden; 93 | zoom: 1; 94 | padding-left: 10px; 95 | } 96 | 97 | #indexSidebar .list ul { 98 | overflow: hidden; 99 | zoom: 1; 100 | } 101 | 102 | #indexSidebar .list li { 103 | float: left; 104 | color: #666; 105 | width: 58px; 106 | height: 24px; 107 | line-height: 24px; 108 | border-bottom: 1px dotted #DDD; 109 | padding-left: 2px; 110 | } 111 | 112 | #indexSidebar .list li a { 113 | color: #666; 114 | } 115 | 116 | #indexSidebar .list .more { 117 | float: right; 118 | margin-top: 5px; 119 | color: #666; 120 | } 121 | 122 | #indexSidebar .hides { 123 | display: none 124 | } 125 | 126 | 127 | 128 | 129 | 130 | 131 | .f666, .f666 a, a.f666, .f666 a:visited, a:visited.f666 { 132 | color: #666; 133 | text-decoration: none; 134 | } 135 | 136 | .f666 a:hover, a.f666:hover { 137 | color: #b50000; 138 | text-decoration: underline; 139 | background: none; 140 | } 141 | 142 | .f666 { 143 | margin-right: 8px; 144 | } 145 | 146 | span.f666 { 147 | display: block; 148 | padding-left: 62px; 149 | padding-top: 2px; 150 | } 151 | 152 | a.f666:hover { 153 | text-decoration: none; 154 | } 155 | 156 | .f666 { 157 | font-weight: normal; 158 | font-size: 12px; 159 | padding-left: 5px; 160 | } 161 | 162 | .f666 { 163 | padding-right: 10px; 164 | } 165 | 166 | .f666 { 167 | width: 60px; 168 | display: block; 169 | float: left; 170 | margin-top: 6px; 171 | } -------------------------------------------------------------------------------- /WebContent/static/css/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */ 2 | html { 3 | font-family: sans-serif; 4 | -ms-text-size-adjust: 100%; 5 | -webkit-text-size-adjust: 100%; 6 | } 7 | 8 | body { 9 | margin: 0; 10 | } 11 | 12 | audio, canvas, progress, video { 13 | display: inline-block; 14 | vertical-align: baseline; 15 | } 16 | 17 | audio:not ([controls] ) { 18 | display: none; 19 | height: 0; 20 | } 21 | 22 | [hidden], template { 23 | display: none; 24 | } 25 | 26 | a { 27 | background-color: transparent; 28 | } 29 | 30 | a:active, a:hover { 31 | outline: 0; 32 | } 33 | 34 | abbr[title] { 35 | border-bottom: 1px dotted; 36 | } 37 | 38 | b, strong { 39 | font-weight: bold; 40 | } 41 | 42 | dfn { 43 | font-style: italic; 44 | } 45 | 46 | h1 { 47 | font-size: 2em; 48 | margin: 0.67em 0; 49 | } 50 | 51 | mark { 52 | background: #ff0; 53 | color: #000; 54 | } 55 | 56 | small { 57 | font-size: 80%; 58 | } 59 | 60 | sub, sup { 61 | font-size: 75%; 62 | line-height: 0; 63 | position: relative; 64 | vertical-align: baseline; 65 | } 66 | 67 | sup { 68 | top: -0.5em; 69 | } 70 | 71 | sub { 72 | bottom: -0.25em; 73 | } 74 | 75 | img { 76 | border: 0; 77 | } 78 | 79 | svg:not (:root ) { 80 | overflow: hidden; 81 | } 82 | 83 | figure { 84 | margin: 1em 40px; 85 | } 86 | 87 | hr { 88 | -moz-box-sizing: content-box; 89 | -webkit-box-sizing: content-box; 90 | box-sizing: content-box; 91 | height: 0; 92 | } 93 | 94 | pre { 95 | overflow: auto; 96 | } 97 | 98 | code, kbd, pre, samp { 99 | font-family: monospace, monospace; 100 | font-size: 1em; 101 | } 102 | 103 | button, input, optgroup, select, textarea { 104 | color: inherit; 105 | font: inherit; 106 | margin: 0; 107 | } 108 | 109 | button { 110 | overflow: visible; 111 | } 112 | 113 | button, select { 114 | text-transform: none; 115 | } 116 | 117 | button, html input[type="button"], input[type="reset"], input[type="submit"] 118 | { 119 | -webkit-appearance: button; 120 | cursor: pointer; 121 | } 122 | 123 | button[disabled], html input[disabled] { 124 | cursor: default; 125 | } 126 | 127 | button::-moz-focus-inner, input::-moz-focus-inner { 128 | border: 0; 129 | padding: 0; 130 | } 131 | 132 | input { 133 | line-height: normal; 134 | } 135 | 136 | input[type="checkbox"], input[type="radio"] { 137 | -webkit-box-sizing: border-box; 138 | -moz-box-sizing: border-box; 139 | box-sizing: border-box; 140 | padding: 0; 141 | } 142 | 143 | input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button 144 | { 145 | height: auto; 146 | } 147 | 148 | input[type="search"] { 149 | -webkit-appearance: textfield; 150 | -moz-box-sizing: content-box; 151 | -webkit-box-sizing: content-box; 152 | box-sizing: content-box; 153 | } 154 | 155 | input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration 156 | { 157 | -webkit-appearance: none; 158 | } 159 | 160 | fieldset { 161 | border: 1px solid #c0c0c0; 162 | margin: 0 2px; 163 | padding: 0.35em 0.625em 0.75em; 164 | } 165 | 166 | legend { 167 | border: 0; 168 | padding: 0; 169 | } 170 | 171 | textarea { 172 | overflow: auto; 173 | } 174 | 175 | optgroup { 176 | font-weight: bold; 177 | } 178 | 179 | table { 180 | border-collapse: collapse; 181 | border-spacing: 0; 182 | } 183 | 184 | td, th { 185 | padding: 0; 186 | } -------------------------------------------------------------------------------- /src/com/csdn/domain/Topic.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.GeneratedValue; 8 | import javax.persistence.GenerationType; 9 | import javax.persistence.Id; 10 | import javax.persistence.JoinColumn; 11 | import javax.persistence.ManyToOne; 12 | import javax.persistence.Table; 13 | import javax.persistence.Transient; 14 | 15 | import org.hibernate.annotations.Cache; 16 | import org.hibernate.annotations.CacheConcurrencyStrategy; 17 | import org.springframework.cache.annotation.Cacheable; 18 | 19 | 20 | @Entity 21 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 22 | @Table(name = "t_topic") 23 | public class Topic extends BaseDomain { 24 | /** 25 | * 精华主题帖子 26 | */ 27 | public static final int DIGEST_TOPIC = 1; 28 | /** 29 | * 普通的主题帖子 30 | */ 31 | public static final int NOT_DIGEST_TOPIC = 0; 32 | 33 | @Id 34 | @GeneratedValue(strategy = GenerationType.IDENTITY) 35 | @Column(name = "topic_id") 36 | private int topicId; 37 | 38 | @Column(name = "topic_title") 39 | private String topicTitle; 40 | 41 | @ManyToOne 42 | @JoinColumn(name = "user_id") 43 | private User user; 44 | 45 | @Column(name = "board_id") 46 | private int boardId; 47 | 48 | @Transient 49 | private MainPost mainPost = new MainPost(); 50 | 51 | @Column(name = "last_post") 52 | private Date lastPost = new Date(); 53 | 54 | @Column(name = "create_time") 55 | private Date createTime = new Date(); 56 | 57 | @Column(name = "topic_views") 58 | private int views; 59 | 60 | @Column(name = "topic_replies") 61 | private int replies; 62 | 63 | private int digest = NOT_DIGEST_TOPIC; 64 | 65 | public Date getCreateTime() { 66 | return createTime; 67 | } 68 | 69 | public void setCreateTime(Date createTime) { 70 | this.createTime = createTime; 71 | } 72 | 73 | public int getDigest() { 74 | return digest; 75 | } 76 | 77 | public void setDigest(int digest) { 78 | this.digest = digest; 79 | } 80 | 81 | public int getBoardId() { 82 | return boardId; 83 | } 84 | 85 | public void setBoardId(int boardId) { 86 | this.boardId = boardId; 87 | } 88 | 89 | public Date getLastPost() { 90 | return lastPost; 91 | } 92 | 93 | public void setLastPost(Date lastPost) { 94 | this.lastPost = lastPost; 95 | } 96 | 97 | public int getReplies() { 98 | return replies; 99 | } 100 | 101 | public void setReplies(int replies) { 102 | this.replies = replies; 103 | } 104 | 105 | public int getTopicId() { 106 | return topicId; 107 | } 108 | 109 | public void setTopicId(int topicId) { 110 | this.topicId = topicId; 111 | } 112 | 113 | public String getTopicTitle() { 114 | return topicTitle; 115 | } 116 | 117 | public void setTopicTitle(String topicTitle) { 118 | this.topicTitle = topicTitle; 119 | } 120 | 121 | public User getUser() { 122 | return user; 123 | } 124 | 125 | public void setUser(User user) { 126 | this.user = user; 127 | } 128 | 129 | public int getViews() { 130 | return views; 131 | } 132 | 133 | public void setViews(int views) { 134 | this.views = views; 135 | } 136 | 137 | public MainPost getMainPost() { 138 | return mainPost; 139 | } 140 | 141 | public void setMainPost(MainPost mainPost) { 142 | this.mainPost = mainPost; 143 | } 144 | 145 | // public Set getMainPosts() 146 | // { 147 | // return mainPosts; 148 | // } 149 | // 150 | // public void setMainPosts(Set mainPosts) 151 | // { 152 | // this.mainPosts = mainPosts; 153 | // } 154 | 155 | } 156 | -------------------------------------------------------------------------------- /src/com/csdn/domain/User.java: -------------------------------------------------------------------------------- 1 | package com.csdn.domain; 2 | 3 | import java.util.Date; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | import javax.persistence.CascadeType; 8 | import javax.persistence.Column; 9 | import javax.persistence.Entity; 10 | import javax.persistence.FetchType; 11 | import javax.persistence.GeneratedValue; 12 | import javax.persistence.GenerationType; 13 | import javax.persistence.Id; 14 | import javax.persistence.JoinColumn; 15 | import javax.persistence.JoinTable; 16 | import javax.persistence.ManyToMany; 17 | import javax.persistence.Table; 18 | 19 | import org.hibernate.annotations.Cache; 20 | import org.hibernate.annotations.CacheConcurrencyStrategy; 21 | 22 | @Entity 23 | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) 24 | @Table(name = "t_user") 25 | public class User extends BaseDomain { 26 | /** 27 | *锁定用户对应的状态值 28 | */ 29 | public static final int USER_LOCK = 1; 30 | /** 31 | * 用户解锁对应的状态值 32 | */ 33 | public static final int USER_UNLOCK = 0; 34 | /** 35 | * 管理员类型 36 | */ 37 | public static final int FORUM_ADMIN = 2; 38 | /** 39 | * 普通用户类型 40 | */ 41 | public static final int NORMAL_USER = 1; 42 | 43 | @Id 44 | @GeneratedValue(strategy = GenerationType.IDENTITY) 45 | @Column(name = "user_id") 46 | private int userId; 47 | 48 | @Column(name = "user_name") 49 | private String userName; 50 | 51 | @Column(name = "user_type") 52 | private int userType = NORMAL_USER; 53 | 54 | @Column(name = "last_ip") 55 | private String lastIp; 56 | 57 | @Column(name = "last_visit") 58 | private Date lastVisit; 59 | 60 | private String password; 61 | 62 | private int locked ; 63 | 64 | private int credit; 65 | 66 | @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER) 67 | @JoinTable(name = "t_board_manager", joinColumns = {@JoinColumn(name ="user_id" )}, inverseJoinColumns = {@JoinColumn(name = "board_id") }) 68 | private Set manBoards = new HashSet(); 69 | 70 | public int getCredit() { 71 | return credit; 72 | } 73 | 74 | public void setCredit(int credit) { 75 | this.credit = credit; 76 | } 77 | 78 | public int getLocked() { 79 | return locked; 80 | } 81 | 82 | public void setLocked(int locked) { 83 | this.locked = locked; 84 | } 85 | 86 | public Set getManBoards() 87 | { 88 | return manBoards; 89 | } 90 | 91 | public void setManBoards(Set manBoards) 92 | { 93 | this.manBoards = manBoards; 94 | } 95 | 96 | public String getPassword() { 97 | return password; 98 | } 99 | 100 | public void setPassword(String password) { 101 | this.password = password; 102 | } 103 | 104 | public int getUserId() { 105 | return userId; 106 | } 107 | 108 | public void setUserId(int userId) { 109 | this.userId = userId; 110 | } 111 | 112 | public String getUserName() { 113 | return userName; 114 | } 115 | 116 | public void setUserName(String userName) { 117 | this.userName = userName; 118 | } 119 | 120 | public int getUserType() 121 | { 122 | return userType; 123 | } 124 | 125 | public void setUserType(int userType) 126 | { 127 | this.userType = userType; 128 | } 129 | 130 | public String getLastIp() { 131 | return lastIp; 132 | } 133 | 134 | public void setLastIp(String lastIp) { 135 | this.lastIp = lastIp; 136 | } 137 | 138 | public Date getLastVisit() { 139 | return lastVisit; 140 | } 141 | 142 | public void setLastVisit(Date lastVisit) { 143 | this.lastVisit = lastVisit; 144 | } 145 | 146 | } 147 | -------------------------------------------------------------------------------- /WebContent/static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Open Sans", sans-serif; 3 | height: 100vh; 4 | background: url("bg.png") 50% fixed; 5 | background-size: cover; 6 | } 7 | 8 | @ 9 | keyframes spinner { 0% { 10 | transform: rotateZ(0deg); 11 | } 12 | 13 | 100% 14 | { 15 | transform 16 | : 17 | 18 | rotateZ 19 | (359deg); 20 | 21 | 22 | } 23 | } 24 | * { 25 | box-sizing: border-box; 26 | } 27 | 28 | .wrapper { 29 | display: flex; 30 | align-items: center; 31 | flex-direction: column; 32 | justify-content: center; 33 | width: 100%; 34 | min-height: 100%; 35 | padding: 20px; 36 | background: rgba(4, 40, 68, 0.25); 37 | } 38 | 39 | .login { 40 | border-radius: 2px 2px 5px 5px; 41 | padding: 10px 20px 20px 20px; 42 | width: 90%; 43 | max-width: 320px; 44 | background: #ffffff; 45 | position: relative; 46 | padding-bottom: 80px; 47 | box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.3); 48 | } 49 | 50 | .login.loading button { 51 | max-height: 100%; 52 | padding-top: 50px; 53 | } 54 | 55 | .login.loading button .spinner { 56 | opacity: 1; 57 | top: 40%; 58 | } 59 | 60 | .login.ok button { 61 | background-color: #8bc34a; 62 | } 63 | 64 | .login.ok button .spinner { 65 | border-radius: 0; 66 | border-top-color: transparent; 67 | border-right-color: transparent; 68 | height: 20px; 69 | animation: none; 70 | transform: rotateZ(-45deg); 71 | } 72 | 73 | .login input { 74 | display: block; 75 | padding: 15px 10px; 76 | margin-bottom: 10px; 77 | width: 100%; 78 | border: 1px solid #ddd; 79 | transition: border-width 0.2s ease; 80 | border-radius: 2px; 81 | color: #ccc; 82 | } 83 | 84 | .login input+i.fa { 85 | color: #fff; 86 | font-size: 1em; 87 | position: absolute; 88 | margin-top: -47px; 89 | opacity: 0; 90 | left: 0; 91 | transition: all 0.1s ease-in; 92 | } 93 | 94 | .login input:focus { 95 | outline: none; 96 | color: #444; 97 | border-color: #2196F3; 98 | border-left-width: 35px; 99 | } 100 | 101 | .login input:focus+i.fa { 102 | opacity: 1; 103 | left: 30px; 104 | transition: all 0.25s ease-out; 105 | } 106 | 107 | .login a { 108 | font-size: 0.8em; 109 | color: #2196F3; 110 | text-decoration: none; 111 | } 112 | 113 | .login .title { 114 | color: #444; 115 | font-size: 1.2em; 116 | font-weight: bold; 117 | margin: 10px 0 30px 0; 118 | border-bottom: 1px solid #eee; 119 | padding-bottom: 20px; 120 | } 121 | 122 | .login button { 123 | width: 100%; 124 | height: 100%; 125 | padding: 10px 10px; 126 | background: #2196F3; 127 | color: #fff; 128 | display: block; 129 | border: none; 130 | margin-top: 20px; 131 | position: absolute; 132 | left: 0; 133 | bottom: 0; 134 | max-height: 60px; 135 | border: 0px solid rgba(0, 0, 0, 0.1); 136 | border-radius: 0 0 2px 2px; 137 | transform: rotateZ(0deg); 138 | transition: all 0.1s ease-out; 139 | border-bottom-width: 7px; 140 | } 141 | 142 | .login button .spinner { 143 | display: block; 144 | width: 40px; 145 | height: 40px; 146 | position: absolute; 147 | border: 4px solid #ffffff; 148 | border-top-color: rgba(255, 255, 255, 0.3); 149 | border-radius: 100%; 150 | left: 50%; 151 | top: 0; 152 | opacity: 0; 153 | margin-left: -20px; 154 | margin-top: -20px; 155 | animation: spinner 0.6s infinite linear; 156 | transition: top 0.3s 0.3s ease, opacity 0.3s 0.3s ease, border-radius 157 | 0.3s ease; 158 | box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.2); 159 | } 160 | 161 | .login:not (.loading ) button:hover { 162 | box-shadow: 0px 1px 3px #2196F3; 163 | } 164 | 165 | .login:not (.loading ) button:focus { 166 | border-bottom-width: 4px; 167 | } 168 | 169 | footer { 170 | display: block; 171 | padding-top: 50px; 172 | text-align: center; 173 | color: #ddd; 174 | font-weight: normal; 175 | text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2); 176 | font-size: 0.8em; 177 | } 178 | 179 | footer a, footer a:link { 180 | color: #fff; 181 | text-decoration: none; 182 | } -------------------------------------------------------------------------------- /WebContent/static/scss/style.scss: -------------------------------------------------------------------------------- 1 | $primary: #2196F3; 2 | 3 | body { 4 | font-family: "Open Sans", sans-serif; 5 | height: 100vh; 6 | background-image: url(bg.png); 7 | background: 50% fixed; 8 | background-size: cover; 9 | } 10 | 11 | @keyframes spinner { 12 | 0% { transform: rotateZ(0deg); } 13 | 100% { transform: rotateZ(359deg); } 14 | } 15 | 16 | * { 17 | box-sizing: border-box; 18 | } 19 | 20 | .wrapper { 21 | display: flex; 22 | align-items: center; 23 | flex-direction: column; 24 | justify-content: center; 25 | width: 100%; 26 | min-height: 100%; 27 | padding: 20px; 28 | background: rgba(darken($primary,40%), 0.85); 29 | } 30 | 31 | 32 | .login { 33 | 34 | border-radius: 2px 2px 5px 5px; 35 | padding: 10px 20px 20px 20px; 36 | width: 90%; 37 | max-width: 320px; 38 | background: #ffffff; 39 | position: relative; 40 | padding-bottom: 80px; 41 | box-shadow: 0px 1px 5px rgba(0,0,0,0.3); 42 | 43 | &.loading { 44 | button { 45 | max-height: 100%; 46 | padding-top: 50px; 47 | .spinner { 48 | opacity: 1; 49 | top: 40%; 50 | } 51 | } 52 | } 53 | 54 | &.ok { 55 | button { 56 | background-color: #8bc34a; 57 | .spinner{ 58 | border-radius: 0; 59 | border-top-color: transparent; 60 | border-right-color: transparent; 61 | height: 20px; 62 | animation: none; 63 | transform: rotateZ(-45deg); 64 | } 65 | } 66 | } 67 | 68 | input { 69 | display: block; 70 | padding: 15px 10px; 71 | margin-bottom: 10px; 72 | width: 100%; 73 | border: 1px solid #ddd; 74 | transition: border-width 0.2s ease; 75 | border-radius: 2px; 76 | color: #ccc; 77 | 78 | &+ i.fa { 79 | color: #fff; 80 | font-size: 1em; 81 | position: absolute; 82 | margin-top: -47px; 83 | opacity: 0; 84 | left: 0; 85 | transition: all 0.1s ease-in; 86 | } 87 | 88 | &:focus { 89 | &+ i.fa { 90 | opacity: 1; 91 | left: 30px; 92 | transition: all 0.25s ease-out; 93 | } 94 | outline: none; 95 | color: #444; 96 | border-color: $primary; 97 | border-left-width: 35px; 98 | } 99 | 100 | } 101 | 102 | a { 103 | font-size: 0.8em; 104 | color: $primary; 105 | text-decoration: none; 106 | } 107 | 108 | .title { 109 | color: #444; 110 | font-size: 1.2em; 111 | font-weight: bold; 112 | margin: 10px 0 30px 0; 113 | border-bottom: 1px solid #eee; 114 | padding-bottom: 20px; 115 | } 116 | 117 | button { 118 | width: 100%; 119 | height: 100%; 120 | padding: 10px 10px; 121 | background: $primary; 122 | color: #fff; 123 | display: block; 124 | border: none; 125 | margin-top: 20px; 126 | position: absolute; 127 | left: 0; 128 | bottom: 0; 129 | max-height: 60px; 130 | border: 0px solid rgba(0,0,0,0.1); 131 | border-radius: 0 0 2px 2px; 132 | transform: rotateZ(0deg); 133 | 134 | transition: all 0.1s ease-out; 135 | border-bottom-width: 7px; 136 | 137 | .spinner { 138 | display: block; 139 | width: 40px; 140 | height: 40px; 141 | position: absolute; 142 | border: 4px solid #ffffff; 143 | border-top-color: rgba(255,255,255,0.3); 144 | border-radius: 100%; 145 | left: 50%; 146 | top: 0; 147 | opacity: 0; 148 | margin-left: -20px; 149 | margin-top: -20px; 150 | animation: spinner 0.6s infinite linear; 151 | transition: top 0.3s 0.3s ease, 152 | opacity 0.3s 0.3s ease, 153 | border-radius 0.3s ease; 154 | box-shadow: 0px 1px 0px rgba(0,0,0,0.2); 155 | } 156 | 157 | } 158 | 159 | &:not(.loading) button:hover { 160 | box-shadow: 0px 1px 3px $primary; 161 | } 162 | &:not(.loading) button:focus { 163 | border-bottom-width: 4px; 164 | } 165 | 166 | 167 | } 168 | 169 | footer { 170 | display: block; 171 | padding-top: 50px; 172 | text-align: center; 173 | color: #ddd; 174 | font-weight: normal; 175 | text-shadow: 0px -1px 0px rgba(0,0,0,0.2); 176 | font-size: 0.8em; 177 | a, a:link { 178 | color: #fff; 179 | text-decoration: none; 180 | } 181 | } -------------------------------------------------------------------------------- /src/com/csdn/web/ForumManageController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.csdn.web; 3 | 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | import org.springframework.web.bind.annotation.RequestParam; 11 | import org.springframework.web.servlet.ModelAndView; 12 | 13 | import com.csdn.domain.Board; 14 | import com.csdn.domain.User; 15 | import com.csdn.service.ForumService; 16 | import com.csdn.service.UserService; 17 | 18 | 19 | /** 20 | * 21 | *
22 | * 类描述: 23 | * 24 | *
 25 |  *   论坛管理,这部分功能由论坛管理员操作,包括:创建论坛版块、指定论坛版块管理员、
 26 |  * 用户锁定/解锁。
 27 |  *
28 | * 29 | * @see 30 | *@since 31 | */ 32 | @Controller 33 | public class ForumManageController extends BaseController { 34 | @Autowired 35 | private ForumService forumService; 36 | @Autowired 37 | private UserService userService; 38 | 39 | /** 40 | * 列出所有的论坛模块 41 | * @param request 42 | * @param response 43 | * @return 44 | */ 45 | @RequestMapping(value = "/index", method = RequestMethod.GET) 46 | public ModelAndView listAllBoards() { 47 | ModelAndView view =new ModelAndView(); 48 | List boards = forumService.getAllBoards(); 49 | view.addObject("boards", boards); 50 | view.setViewName("/listAllBoards"); 51 | return view; 52 | } 53 | 54 | /** 55 | * 添加一个主题帖 56 | * @param request 57 | * @param response 58 | * @return 59 | */ 60 | @RequestMapping(value = "/forum/addBoardPage", method = RequestMethod.GET) 61 | public String addBoardPage() { 62 | return "/addBoard"; 63 | } 64 | 65 | /** 66 | * 添加一个主题帖 67 | * @param request 68 | * @param response 69 | * @param board 70 | * @return 71 | */ 72 | @RequestMapping(value = "/forum/addBoard", method = RequestMethod.POST) 73 | public String addBoard(Board board) { 74 | forumService.addBoard(board); 75 | return "/addBoardSuccess"; 76 | } 77 | 78 | /** 79 | * 指定论坛管理员的页面 80 | * @param request 81 | * @param response 82 | * @return 83 | */ 84 | @RequestMapping(value = "/forum/setBoardManagerPage", method = RequestMethod.GET) 85 | public ModelAndView setBoardManagerPage() { 86 | ModelAndView view =new ModelAndView(); 87 | List boards = forumService.getAllBoards(); 88 | List users = userService.getAllUsers(); 89 | view.addObject("boards", boards); 90 | view.addObject("users", users); 91 | view.setViewName("/setBoardManager"); 92 | return view; 93 | } 94 | 95 | /** 96 | * 设置版块管理 97 | * @param request 98 | * @param response 99 | * @return 100 | */ 101 | @RequestMapping(value = "/forum/setBoardManager", method = RequestMethod.GET) 102 | public ModelAndView setBoardManager(@RequestParam("userName") String userName 103 | ,@RequestParam("boardId") String boardId) { 104 | ModelAndView view =new ModelAndView(); 105 | User user = userService.getUserByUserName(userName); 106 | if (user == null) { 107 | view.addObject("errorMsg", "用户名(" + userName 108 | + ")不存在"); 109 | view.setViewName("/fail"); 110 | } else { 111 | Board board = forumService.getBoardById(Integer.parseInt(boardId)); 112 | user.getManBoards().add(board); 113 | userService.update(user); 114 | view.setViewName("/success"); 115 | } 116 | return view; 117 | } 118 | 119 | /** 120 | * 用户锁定及解锁管理页面 121 | * @param request 122 | * @param response 123 | * @return 124 | */ 125 | @RequestMapping(value = "/forum/userLockManagePage", method = RequestMethod.GET) 126 | public ModelAndView userLockManagePage() { 127 | System.out.println("step0"); 128 | ModelAndView view =new ModelAndView(); 129 | List users = userService.getAllUsers(); 130 | view.setViewName("/userLockManage"); 131 | view.addObject("users", users); 132 | return view; 133 | } 134 | 135 | /** 136 | * 用户锁定及解锁设定 137 | * @param request 138 | * @param response 139 | * @return 140 | */ 141 | 142 | @RequestMapping(value = "/forum/userLockManage", method = RequestMethod.POST) 143 | public ModelAndView userLockManage(@RequestParam("userName") String userName 144 | ,@RequestParam("locked") String locked) { 145 | System.out.println("step1"); 146 | ModelAndView view =new ModelAndView(); 147 | User user = userService.getUserByUserName(userName); 148 | if (user == null) { 149 | System.out.println("step2"); 150 | view.addObject("errorMsg", "用户名(" + userName 151 | + ")不存在"); 152 | view.setViewName("/fail"); 153 | } else { 154 | System.out.println("step3"); 155 | user.setLocked(Integer.parseInt(locked)); 156 | userService.update(user); 157 | view.setViewName("/success"); 158 | } 159 | return view; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /WebContent/static/css/other.css: -------------------------------------------------------------------------------- 1 | /* cyrillic-ext */ 2 | @font-face { 3 | font-family: 'Open Sans'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/K88pR3goAWT7BTt32Z01m4X0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 7 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; 8 | } 9 | /* cyrillic */ 10 | @font-face { 11 | font-family: 'Open Sans'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/RjgO7rYTmqiVp7vzi-Q5UYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 15 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; 16 | } 17 | /* greek-ext */ 18 | @font-face { 19 | font-family: 'Open Sans'; 20 | font-style: normal; 21 | font-weight: 400; 22 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/LWCjsQkB6EMdfHrEVqA1KYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 23 | unicode-range: U+1F00-1FFF; 24 | } 25 | /* greek */ 26 | @font-face { 27 | font-family: 'Open Sans'; 28 | font-style: normal; 29 | font-weight: 400; 30 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/xozscpT2726on7jbcb_pAoX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 31 | unicode-range: U+0370-03FF; 32 | } 33 | /* vietnamese */ 34 | @font-face { 35 | font-family: 'Open Sans'; 36 | font-style: normal; 37 | font-weight: 400; 38 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/59ZRklaO5bWGqF5A9baEEYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 39 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 40 | } 41 | /* latin-ext */ 42 | @font-face { 43 | font-family: 'Open Sans'; 44 | font-style: normal; 45 | font-weight: 400; 46 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/u-WUoqrET9fUeobQW7jkRYX0hVgzZQUfRDuZrPvH3D8.woff2) format('woff2'); 47 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 48 | } 49 | /* latin */ 50 | @font-face { 51 | font-family: 'Open Sans'; 52 | font-style: normal; 53 | font-weight: 400; 54 | src: local('Open Sans'), local('OpenSans'), url(http://fonts.gstatic.com/s/opensans/v13/cJZKeOuBrn4kERxqtaUH3ZBw1xU1rKptJj_0jans920.woff2) format('woff2'); 55 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; 56 | } 57 | /* cyrillic-ext */ 58 | @font-face { 59 | font-family: 'Open Sans'; 60 | font-style: normal; 61 | font-weight: 700; 62 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzA7aC6SjiAOpAWOKfJDfVRY.woff2) format('woff2'); 63 | unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; 64 | } 65 | /* cyrillic */ 66 | @font-face { 67 | font-family: 'Open Sans'; 68 | font-style: normal; 69 | font-weight: 700; 70 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzBdwxCXfZpKo5kWAx_74bHs.woff2) format('woff2'); 71 | unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; 72 | } 73 | /* greek-ext */ 74 | @font-face { 75 | font-family: 'Open Sans'; 76 | font-style: normal; 77 | font-weight: 700; 78 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzJ6vnaPZw6nYDxM4SVEMFKg.woff2) format('woff2'); 79 | unicode-range: U+1F00-1FFF; 80 | } 81 | /* greek */ 82 | @font-face { 83 | font-family: 'Open Sans'; 84 | font-style: normal; 85 | font-weight: 700; 86 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzPy1_HTwRwgtl1cPga3Fy3Y.woff2) format('woff2'); 87 | unicode-range: U+0370-03FF; 88 | } 89 | /* vietnamese */ 90 | @font-face { 91 | font-family: 'Open Sans'; 92 | font-style: normal; 93 | font-weight: 700; 94 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzPgrLsWo7Jk1KvZser0olKY.woff2) format('woff2'); 95 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 96 | } 97 | /* latin-ext */ 98 | @font-face { 99 | font-family: 'Open Sans'; 100 | font-style: normal; 101 | font-weight: 700; 102 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzIjoYw3YTyktCCer_ilOlhE.woff2) format('woff2'); 103 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 104 | } 105 | /* latin */ 106 | @font-face { 107 | font-family: 'Open Sans'; 108 | font-style: normal; 109 | font-weight: 700; 110 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://fonts.gstatic.com/s/opensans/v13/k3k702ZOKiLJc3WVjuplzBampu5_7CjHW5spxoeN3Vs.woff2) format('woff2'); 111 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; 112 | } -------------------------------------------------------------------------------- /WebContent/static/js/prefixfree.min.js: -------------------------------------------------------------------------------- 1 | !function(){function e(e,r){return[].slice.call((r||document).querySelectorAll(e))}if(window.addEventListener){var r=window.StyleFix={link:function(e){try{if("stylesheet"!==e.rel||e.hasAttribute("data-noprefix"))return}catch(t){return}var n,i=e.href||e.getAttribute("data-href"),a=i.replace(/[^\/]+$/,""),o=(/^[a-z]{3,10}:/.exec(a)||[""])[0],s=(/^[a-z]{3,10}:\/\/[^\/]+/.exec(a)||[""])[0],l=/^([^?]*)\??/.exec(i)[1],u=e.parentNode,p=new XMLHttpRequest;p.onreadystatechange=function(){4===p.readyState&&n()},n=function(){var t=p.responseText;if(t&&e.parentNode&&(!p.status||p.status<400||p.status>600)){if(t=r.fix(t,!0,e),a){t=t.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi,function(e,r,t){return/^([a-z]{3,10}:|#)/i.test(t)?e:/^\/\//.test(t)?'url("'+o+t+'")':/^\//.test(t)?'url("'+s+t+'")':/^\?/.test(t)?'url("'+l+t+'")':'url("'+a+t+'")'});var n=a.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");t=t.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+n,"gi"),"$1")}var i=document.createElement("style");i.textContent=t,i.media=e.media,i.disabled=e.disabled,i.setAttribute("data-href",e.getAttribute("href")),u.insertBefore(i,e),u.removeChild(e),i.media=e.media}};try{p.open("GET",i),p.send(null)}catch(t){"undefined"!=typeof XDomainRequest&&(p=new XDomainRequest,p.onerror=p.onprogress=function(){},p.onload=n,p.open("GET",i),p.send(null))}e.setAttribute("data-inprogress","")},styleElement:function(e){if(!e.hasAttribute("data-noprefix")){var t=e.disabled;e.textContent=r.fix(e.textContent,!0,e),e.disabled=t}},styleAttribute:function(e){var t=e.getAttribute("style");t=r.fix(t,!1,e),e.setAttribute("style",t)},process:function(){e("style").forEach(StyleFix.styleElement),e("[style]").forEach(StyleFix.styleAttribute)},register:function(e,t){(r.fixers=r.fixers||[]).splice(void 0===t?r.fixers.length:t,0,e)},fix:function(e,t,n){for(var i=0;i-1&&(e=e.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/gi,function(e,r,t,n){return r+(t||"")+"linear-gradient("+(90-n)+"deg"})),e=r("functions","(\\s|:|,)","\\s*\\(","$1"+i+"$2(",e),e=r("keywords","(\\s|:)","(\\s|;|\\}|$)","$1"+i+"$2$3",e),e=r("properties","(^|\\{|\\s|;)","\\s*:","$1"+i+"$2:",e),t.properties.length){var a=RegExp("\\b("+t.properties.join("|")+")(?!:)","gi");e=r("valueProperties","\\b",":(.+?);",function(e){return e.replace(a,i+"$1")},e)}return n&&(e=r("selectors","","\\b",t.prefixSelector,e),e=r("atrules","@","\\b","@"+i+"$1",e)),e=e.replace(RegExp("-"+i,"g"),"-"),e=e.replace(/-\*-(?=[a-z]+)/gi,t.prefix)},property:function(e){return(t.properties.indexOf(e)?t.prefix:"")+e},value:function(e){return e=r("functions","(^|\\s|,)","\\s*\\(","$1"+t.prefix+"$2(",e),e=r("keywords","(^|\\s)","(\\s|$)","$1"+t.prefix+"$2$3",e)},prefixSelector:function(e){return e.replace(/^:{1,2}/,function(e){return e+t.prefix})},prefixProperty:function(e,r){var n=t.prefix+e;return r?StyleFix.camelCase(n):n}};!function(){var e={},r=[],n=getComputedStyle(document.documentElement,null),i=document.createElement("div").style,a=function(t){if("-"===t.charAt(0)){r.push(t);var n=t.split("-"),i=n[1];for(e[i]=++e[i]||1;n.length>3;){n.pop();var a=n.join("-");o(a)&&-1===r.indexOf(a)&&r.push(a)}}},o=function(e){return StyleFix.camelCase(e)in i};if(n.length>0)for(var s=0;s{ 22 | private Class entityClass; 23 | @Autowired 24 | private HibernateTemplate hibernateTemplate; 25 | /** 26 | * 通过反射获取子类确定的泛型类 27 | */ 28 | public BaseDao() { 29 | Type genType = getClass().getGenericSuperclass(); 30 | Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); 31 | entityClass = (Class) params[0]; 32 | } 33 | 34 | /** 35 | * 根据ID加载PO实例 36 | * 37 | * @param id 38 | * @return 返回相应的持久化PO实例 39 | */ 40 | public T load(Serializable id) { 41 | return (T) getHibernateTemplate().load(entityClass, id); 42 | } 43 | 44 | /** 45 | * 根据ID获取PO实例 46 | * 47 | * @param id 48 | * @return 返回相应的持久化PO实例 49 | */ 50 | public T get(Serializable id) { 51 | return (T) getHibernateTemplate().get(entityClass, id); 52 | } 53 | 54 | /** 55 | * 获取PO的所有对象 56 | * 57 | * @return 58 | */ 59 | public List loadAll() { 60 | return getHibernateTemplate().loadAll(entityClass); 61 | } 62 | 63 | /** 64 | * 保存PO 65 | * 66 | * @param entity 67 | */ 68 | public void save(T entity) { 69 | getHibernateTemplate().save(entity); 70 | } 71 | 72 | /** 73 | * 删除PO 74 | * 75 | * @param entity 76 | */ 77 | public void remove(T entity) { 78 | getHibernateTemplate().delete(entity); 79 | } 80 | 81 | /** 82 | * 更改PO 83 | * 84 | * @param entity 85 | */ 86 | public void update(T entity) { 87 | getHibernateTemplate().update(entity); 88 | } 89 | 90 | /** 91 | * 执行HQL查询 92 | * 93 | * @param sql 94 | * @return 查询结果 95 | */ 96 | public List find(String hql) { 97 | return this.getHibernateTemplate().find(hql); 98 | } 99 | 100 | /** 101 | * 执行带参的HQL查询 102 | * 103 | * @param sql 104 | * @param params 105 | * @return 查询结果 106 | */ 107 | public List find(String hql, Object... params) { 108 | return this.getHibernateTemplate().find(hql,params); 109 | } 110 | 111 | /** 112 | * 对延迟加载的实体PO执行初始化 113 | * @param entity 114 | */ 115 | public void initialize(Object entity) { 116 | this.getHibernateTemplate().initialize(entity); 117 | } 118 | 119 | 120 | /** 121 | * 分页查询函数,使用hql. 122 | * 123 | * @param pageNo 页号,从1开始. 124 | */ 125 | public Page pagedQuery(String hql, int pageNo, int pageSize, Object... values) { 126 | Assert.hasText(hql); 127 | Assert.isTrue(pageNo >= 1, "pageNo should start from 1"); 128 | // Count查询 129 | String countQueryString = " select count (*) " + removeSelect(removeOrders(hql)); 130 | List countlist = getHibernateTemplate().find(countQueryString, values); 131 | long totalCount = (Long) countlist.get(0); 132 | 133 | if (totalCount < 1) 134 | return new Page(); 135 | // 实际查询返回分页对象 136 | int startIndex = Page.getStartOfPage(pageNo, pageSize); 137 | Query query = createQuery(hql, values); 138 | List list = query.setFirstResult(startIndex).setMaxResults(pageSize).list(); 139 | 140 | return new Page(startIndex, totalCount, pageSize, list); 141 | } 142 | 143 | /** 144 | * 创建Query对象. 对于需要first,max,fetchsize,cache,cacheRegion等诸多设置的函数,可以在返回Query后自行设置. 145 | * 留意可以连续设置,如下: 146 | *
147 | 	 * dao.getQuery(hql).setMaxResult(100).setCacheable(true).list();
148 | 	 * 
149 | * 调用方式如下: 150 | *
151 | 	 *        dao.createQuery(hql)
152 | 	 *        dao.createQuery(hql,arg0);
153 | 	 *        dao.createQuery(hql,arg0,arg1);
154 | 	 *        dao.createQuery(hql,new Object[arg0,arg1,arg2])
155 | 	 * 
156 | * 157 | * @param values 可变参数. 158 | */ 159 | public Query createQuery(String hql, Object... values) { 160 | Assert.hasText(hql); 161 | Query query = getSession().createQuery(hql); 162 | for (int i = 0; i < values.length; i++) { 163 | query.setParameter(i, values[i]); 164 | } 165 | return query; 166 | } 167 | /** 168 | * 去除hql的select 子句,未考虑union的情况,用于pagedQuery. 169 | * 170 | * @see #pagedQuery(String,int,int,Object[]) 171 | */ 172 | private static String removeSelect(String hql) { 173 | Assert.hasText(hql); 174 | int beginPos = hql.toLowerCase().indexOf("from"); 175 | Assert.isTrue(beginPos != -1, " hql : " + hql + " must has a keyword 'from'"); 176 | return hql.substring(beginPos); 177 | } 178 | 179 | /** 180 | * 去除hql的orderby 子句,用于pagedQuery. 181 | * 182 | * @see #pagedQuery(String,int,int,Object[]) 183 | */ 184 | private static String removeOrders(String hql) { 185 | Assert.hasText(hql); 186 | Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE); 187 | Matcher m = p.matcher(hql); 188 | StringBuffer sb = new StringBuffer(); 189 | while (m.find()) { 190 | m.appendReplacement(sb, ""); 191 | } 192 | m.appendTail(sb); 193 | return sb.toString(); 194 | } 195 | 196 | public HibernateTemplate getHibernateTemplate() { 197 | return hibernateTemplate; 198 | } 199 | 200 | public void setHibernateTemplate(HibernateTemplate hibernateTemplate) { 201 | this.hibernateTemplate = hibernateTemplate; 202 | } 203 | public Session getSession() { 204 | return SessionFactoryUtils.getSession(hibernateTemplate.getSessionFactory(),true); 205 | } 206 | 207 | } -------------------------------------------------------------------------------- /src/com/csdn/web/BoardManageController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by MyEclipse Struts 3 | * Template path: templates/java/JavaClass.vtl 4 | */ 5 | package com.csdn.web; 6 | 7 | import java.util.Date; 8 | 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.PathVariable; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestMethod; 16 | import org.springframework.web.bind.annotation.RequestParam; 17 | import org.springframework.web.servlet.ModelAndView; 18 | 19 | import com.csdn.cons.CommonConstant; 20 | import com.csdn.dao.Page; 21 | import com.csdn.domain.Board; 22 | import com.csdn.domain.Post; 23 | import com.csdn.domain.Topic; 24 | import com.csdn.domain.User; 25 | import com.csdn.service.ForumService; 26 | 27 | 28 | 29 | /** 30 | * 31 | *
32 | * 类描述: 33 | * 34 | *
 35 |  *   这个Action负责处理论坛普通操作功能的请求,包括:显示论坛版块列表、显示论坛版块主题列表、
 36 |  * 表主题帖、回复帖子、删除帖子、设置精华帖子等操作。
 37 |  * 
38 | * 39 | * @see 40 | * @since 41 | */ 42 | @Controller 43 | public class BoardManageController extends BaseController { 44 | @Autowired 45 | private ForumService forumService; 46 | 47 | /** 48 | * 列出论坛模块下的主题帖子 49 | * 50 | * @param boardId 51 | * @param request 52 | * @param response 53 | * @return 54 | */ 55 | @RequestMapping(value = "/board/listBoardTopics-{boardId}", method = RequestMethod.GET) 56 | public ModelAndView listBoardTopics(@PathVariable Integer boardId,@RequestParam(value = "pageNo", required = false) Integer pageNo) { 57 | ModelAndView view =new ModelAndView(); 58 | Board board = forumService.getBoardById(boardId); 59 | pageNo = pageNo==null?1:pageNo; 60 | Page pagedTopic = forumService.getPagedTopics(boardId, pageNo, 61 | CommonConstant.PAGE_SIZE); 62 | view.addObject("board", board); 63 | view.addObject("pagedTopic", pagedTopic); 64 | view.setViewName("/listBoardTopics"); 65 | return view; 66 | } 67 | 68 | /** 69 | * 添加主题帖页面 70 | * @param boardId 71 | * @param request 72 | * @return 73 | */ 74 | @RequestMapping(value = "/board/addTopicPage-{boardId}", method = RequestMethod.GET) 75 | public ModelAndView addTopicPage(@PathVariable Integer boardId) { 76 | ModelAndView view =new ModelAndView(); 77 | view.addObject("boardId", boardId); 78 | view.setViewName("/addTopic"); 79 | return view; 80 | } 81 | 82 | /** 83 | * 添加一个主题帖 84 | * 85 | * @param request 86 | * @param response 87 | * @param topic 88 | * @return 89 | */ 90 | @RequestMapping(value = "/board/addTopic", method = RequestMethod.POST) 91 | public String addTopic(HttpServletRequest request,Topic topic) { 92 | User user = getSessionUser(request); 93 | topic.setUser(user); 94 | Date now = new Date(); 95 | topic.setCreateTime(now); 96 | topic.setLastPost(now); 97 | forumService.addTopic(topic); 98 | String targetUrl = "/board/listBoardTopics-" + topic.getBoardId() 99 | + ".html"; 100 | return "redirect:"+targetUrl; 101 | } 102 | 103 | /** 104 | * 列出主题的所有帖子 105 | * 106 | * @param topicId 107 | * @param request 108 | * @param response 109 | * @return 110 | */ 111 | @RequestMapping(value = "/board/listTopicPosts-{topicId}", method = RequestMethod.GET) 112 | public ModelAndView listTopicPosts(@PathVariable Integer topicId,@RequestParam(value = "pageNo", required = false) Integer pageNo) { 113 | ModelAndView view =new ModelAndView(); 114 | Topic topic = forumService.getTopicByTopicId(topicId); 115 | pageNo = pageNo==null?1:pageNo; 116 | Page pagedPost = forumService.getPagedPosts(topicId, pageNo, 117 | CommonConstant.PAGE_SIZE); 118 | // 为回复帖子表单准备数据 119 | view.addObject("topic", topic); 120 | view.addObject("pagedPost", pagedPost); 121 | view.setViewName("/listTopicPosts"); 122 | return view; 123 | } 124 | 125 | /** 126 | * 回复主题 127 | * 128 | * @param request 129 | * @param response 130 | * @param post 131 | * @return 132 | */ 133 | @RequestMapping(value = "/board/addPost") 134 | public String addPost(HttpServletRequest request, Post post) { 135 | post.setCreateTime(new Date()); 136 | post.setUser(getSessionUser(request)); 137 | forumService.addPost(post); 138 | String targetUrl = "/board/listTopicPosts-" 139 | + post.getTopic().getTopicId() + ".html"; 140 | return "redirect:"+targetUrl; 141 | } 142 | 143 | /** 144 | * 删除版块 145 | * 146 | * @param request 147 | * @param response 148 | */ 149 | @RequestMapping(value = "/board/removeBoard", method = RequestMethod.GET) 150 | public String removeBoard(@RequestParam("boardIds") String boardIds) { 151 | String[] arrIds = boardIds.split(","); 152 | for (int i = 0; i < arrIds.length; i++) { 153 | forumService.removeBoard(new Integer(arrIds[i])); 154 | } 155 | String targetUrl = "/index.html"; 156 | return "redirect:"+targetUrl; 157 | } 158 | 159 | /** 160 | * 删除主题 161 | * 162 | * @param request 163 | * @param response 164 | */ 165 | @RequestMapping(value = "/board/removeTopic", method = RequestMethod.GET) 166 | public String removeTopic(@RequestParam("topicIds") String topicIds,@RequestParam("boardId") String boardId) { 167 | String[] arrIds = topicIds.split(","); 168 | for (int i = 0; i < arrIds.length; i++) { 169 | forumService.removeTopic(new Integer(arrIds[i])); 170 | } 171 | String targetUrl = "/board/listBoardTopics-" + boardId + ".html"; 172 | return "redirect:"+targetUrl; 173 | } 174 | 175 | /** 176 | * 设置精华帖 177 | * @param request 178 | * @param response 179 | */ 180 | @RequestMapping(value = "/board/makeDigestTopic", method = RequestMethod.GET) 181 | public String makeDigestTopic(@RequestParam("topicIds") String topicIds,@RequestParam("boardId") String boardId) { 182 | String[] arrIds = topicIds.split(","); 183 | for (int i = 0; i < arrIds.length; i++) { 184 | forumService.makeDigestTopic(new Integer(arrIds[i])); 185 | } 186 | String targetUrl = "/board/listBoardTopics-" + boardId + ".html"; 187 | return "redirect:"+targetUrl; 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/com/csdn/service/ForumService.java: -------------------------------------------------------------------------------- 1 | package com.csdn.service; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.csdn.dao.BoardDao; 10 | import com.csdn.dao.Page; 11 | import com.csdn.dao.PostDao; 12 | import com.csdn.dao.TopicDao; 13 | import com.csdn.dao.UserDao; 14 | import com.csdn.domain.Board; 15 | import com.csdn.domain.MainPost; 16 | import com.csdn.domain.Post; 17 | import com.csdn.domain.Topic; 18 | import com.csdn.domain.User; 19 | 20 | @Service 21 | public class ForumService { 22 | @Autowired 23 | private TopicDao topicDao; 24 | @Autowired 25 | private UserDao userDao; 26 | @Autowired 27 | private BoardDao boardDao; 28 | @Autowired 29 | private PostDao postDao; 30 | 31 | 32 | /** 33 | * 发表一个主题帖子,用户积分加10,论坛版块的主题帖数加1 34 | * @param topic 35 | */ 36 | public void addTopic(Topic topic) { 37 | Board board = (Board) boardDao.get(topic.getBoardId()); 38 | board.setTopicNum(board.getTopicNum() + 1); 39 | topicDao.save(topic); 40 | //topicDao.getHibernateTemplate().flush(); 41 | 42 | topic.getMainPost().setTopic(topic); 43 | MainPost post = topic.getMainPost(); 44 | post.setCreateTime(new Date()); 45 | post.setUser(topic.getUser()); 46 | post.setPostTitle(topic.getTopicTitle()); 47 | post.setBoardId(topic.getBoardId()); 48 | postDao.save(topic.getMainPost()); 49 | 50 | User user = topic.getUser(); 51 | user.setCredit(user.getCredit() + 10); 52 | userDao.update(user); 53 | } 54 | 55 | 56 | /** 57 | * 删除一个主题帖,用户积分减50,论坛版块主题帖数减1,删除 58 | * 主题帖所有关联的帖子。 59 | * @param topicId 要删除的主题帖ID 60 | */ 61 | public void removeTopic(int topicId) { 62 | Topic topic = topicDao.get(topicId); 63 | 64 | // 将论坛版块的主题帖数减1 65 | Board board = boardDao.get(topic.getBoardId()); 66 | board.setTopicNum(board.getTopicNum() - 1); 67 | 68 | // 发表该主题帖用户扣除50积分 69 | User user = topic.getUser(); 70 | user.setCredit(user.getCredit() - 50); 71 | 72 | // 删除主题帖及其关联的帖子 73 | topicDao.remove(topic); 74 | postDao.deleteTopicPosts(topicId); 75 | } 76 | 77 | /** 78 | * 添加一个回复帖子,用户积分加5分,主题帖子回复数加1并更新最后回复时间 79 | * @param post 80 | */ 81 | public void addPost(Post post){ 82 | postDao.save(post); 83 | 84 | User user = post.getUser(); 85 | user.setCredit(user.getCredit() + 5); 86 | userDao.update(user); 87 | 88 | Topic topic = topicDao.get(post.getTopic().getTopicId()); 89 | topic.setReplies(topic.getReplies() + 1); 90 | topic.setLastPost(new Date()); 91 | //topic处于Hibernate受管状态,无须显示更新 92 | //topicDao.update(topic); 93 | } 94 | 95 | /** 96 | * 删除一个回复的帖子,发表回复帖子的用户积分减20,主题帖的回复数减1 97 | * @param postId 98 | */ 99 | public void removePost(int postId){ 100 | Post post = postDao.get(postId); 101 | postDao.remove(post); 102 | 103 | Topic topic = topicDao.get(post.getTopic().getTopicId()); 104 | topic.setReplies(topic.getReplies() - 1); 105 | 106 | User user =post.getUser(); 107 | user.setCredit(user.getCredit() - 20); 108 | 109 | //topic处于Hibernate受管状态,无须显示更新 110 | //topicDao.update(topic); 111 | //userDao.update(user); 112 | } 113 | 114 | 115 | 116 | /** 117 | * 创建一个新的论坛版块 118 | * 119 | * @param board 120 | */ 121 | public void addBoard(Board board) { 122 | boardDao.save(board); 123 | } 124 | 125 | /** 126 | * 删除一个版块 127 | * @param boardId 128 | */ 129 | public void removeBoard(int boardId){ 130 | Board board = boardDao.get(boardId); 131 | boardDao.remove(board); 132 | } 133 | 134 | /** 135 | * 将帖子置为精华主题帖 136 | * @param topicId 操作的目标主题帖ID 137 | * @param digest 精华级别 可选的值为1,2,3 138 | */ 139 | public void makeDigestTopic(int topicId){ 140 | Topic topic = topicDao.get(topicId); 141 | topic.setDigest(Topic.DIGEST_TOPIC); 142 | User user = topic.getUser(); 143 | user.setCredit(user.getCredit() + 100); 144 | //topic 处于Hibernate受管状态,无须显示更新 145 | //topicDao.update(topic); 146 | //userDao.update(user); 147 | } 148 | 149 | /** 150 | * 获取所有的论坛版块 151 | * @return 152 | */ 153 | public List getAllBoards(){ 154 | return boardDao.loadAll(); 155 | } 156 | 157 | /** 158 | * 获取论坛版块某一页主题帖,以最后回复时间降序排列 159 | * @param boardId 160 | * @return 161 | */ 162 | public Page getPagedTopics(int boardId,int pageNo,int pageSize){ 163 | return topicDao.getPagedTopics(boardId,pageNo,pageSize); 164 | } 165 | 166 | /** 167 | * 获取同主题每一页帖子,以最后回复时间降序排列 168 | * @param boardId 169 | * @return 170 | */ 171 | public Page getPagedPosts(int topicId,int pageNo,int pageSize){ 172 | return postDao.getPagedPosts(topicId,pageNo,pageSize); 173 | } 174 | 175 | 176 | /** 177 | * 查找出所有包括标题包含title的主题帖 178 | * 179 | * @param title 180 | * 标题查询条件 181 | * @return 标题包含title的主题帖 182 | */ 183 | public Page queryTopicByTitle(String title,int pageNo,int pageSize) { 184 | return topicDao.queryTopicByTitle(title,pageNo,pageSize); 185 | } 186 | 187 | /** 188 | * 根据boardId获取Board对象 189 | * 190 | * @param boardId 191 | */ 192 | public Board getBoardById(int boardId) { 193 | return boardDao.get(boardId); 194 | } 195 | 196 | /** 197 | * 根据topicId获取Topic对象 198 | * @param topicId 199 | * @return Topic 200 | */ 201 | public Topic getTopicByTopicId(int topicId) { 202 | return topicDao.get(topicId); 203 | } 204 | 205 | /** 206 | * 获取回复帖子的对象 207 | * @param postId 208 | * @return 回复帖子的对象 209 | */ 210 | public Post getPostByPostId(int postId){ 211 | return postDao.get(postId); 212 | } 213 | 214 | /** 215 | * 将用户设为论坛版块的管理员 216 | * @param boardId 论坛版块ID 217 | * @param userName 设为论坛管理的用户名 218 | */ 219 | public void addBoardManager(int boardId,String userName){ 220 | User user = userDao.getUserByUserName(userName); 221 | if(user == null){ 222 | throw new RuntimeException("用户名为"+userName+"的用户不存在。"); 223 | }else{ 224 | Board board = boardDao.get(boardId); 225 | user.getManBoards().add(board); 226 | userDao.update(user); 227 | } 228 | } 229 | 230 | /** 231 | * 更改主题帖 232 | * @param topic 233 | */ 234 | public void updateTopic(Topic topic){ 235 | topicDao.update(topic); 236 | } 237 | 238 | /** 239 | * 更改回复帖子的内容 240 | * @param post 241 | */ 242 | public void updatePost(Post post){ 243 | postDao.update(post); 244 | } 245 | 246 | } 247 | -------------------------------------------------------------------------------- /WebContent/static/css/board.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | ul{ 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | a:link { text-decoration: none; color: red;}  11 |    a:hover { text-decoration:underline; color: red;} 12 |    a:visited { text-decoration: none; color: red;} 13 | 14 | .head{ 15 | width: 100%; 16 | height: 20px; 17 | position: absolute; 18 | z-index: 5; 19 | top: 0; 20 | text-align: right; 21 | border-bottom: 1px solid #E3E3E3; 22 | font-size: 15px; 23 | } 24 | .head span{ 25 | color: #999999; 26 | } 27 | .register{ 28 | background: #0073BA; 29 | color: white; 30 | text-decoration: none; 31 | } 32 | .register:hover{ 33 | opacity: 0.8; 34 | } 35 | .login{ 36 | text-decoration: none; 37 | padding-right: 85px; 38 | } 39 | .login:hover{ 40 | text-decoration: underline; 41 | } 42 | .banner{ 43 | width: 1200px; 44 | height: 155px; 45 | margin: 30px auto; 46 | } 47 | .banner img{ 48 | margin-top: 15px; 49 | float: left; 50 | } 51 | .banner_top{ 52 | width: 1005px; 53 | height: 28px; 54 | line-height: 28px; 55 | float: left; 56 | margin-left: 5px; 57 | margin-top: 10px; 58 | background: #A41F24; 59 | border-top: 1px solid #C24A52; 60 | border-right: #C24A52; 61 | } 62 | .banner_top li{ 63 | float: left; 64 | list-style: none; 65 | margin-left: 10px; 66 | padding-right: 5px; 67 | color: white; 68 | border-right: 1px solid #8E0D12; 69 | font-family: 黑体; 70 | } 71 | .banner_top li:hover{ 72 | text-decoration: underline; 73 | } 74 | .banner_middle{ 75 | width: 1005px; 76 | height: 28px; 77 | line-height: 28px; 78 | float: left; 79 | margin-left: 5px; 80 | background: #E3E7EB; 81 | } 82 | .banner_middle li{ 83 | list-style: none; 84 | float: left; 85 | padding-right: 5px; 86 | border-right: 1px solid #D0D0D1; 87 | margin-left: 10px; 88 | font-family: 黑体; 89 | font-size: 15px; 90 | color: #444444; 91 | } 92 | .content{ 93 | width: 1200px; 94 | height: 330px; 95 | margin: 0 auto; 96 | } 97 | .content_left{ 98 | width: 150px; 99 | height: 100%; 100 | float: left; 101 | background: #ECF1F4; 102 | border: 1px solid #AAAAAA; 103 | } 104 | .content_left>div{ 105 | width: 120px;; 106 | height: 40px; 107 | line-height: 40px; 108 | border-bottom: 1px solid white; 109 | margin-left: 30px; 110 | position: relative; 111 | background: #ECF1F4; 112 | } 113 | .bkfl{ 114 | color: red; 115 | font-weight: bold; 116 | } 117 | .yj_block{ 118 | width: 770px; 119 | height: 100px; 120 | background: rgb(240,243,241); 121 | position: absolute; 122 | left: 120px; 123 | top: 0; 124 | display: none; 125 | } 126 | .yj:hover .yj_block{ 127 | display: block; 128 | } 129 | .yjs_block{ 130 | width: 770px; 131 | height: 200px; 132 | background: rgb(240,243,241); 133 | position: absolute; 134 | left: 120px; 135 | top: -41px; 136 | display: none; 137 | } 138 | .yjs:hover .yjs_block{ 139 | display: block; 140 | } 141 | .dsj_block{ 142 | width: 770px; 143 | height: 200px; 144 | background: rgb(240,243,241); 145 | position: absolute; 146 | left: 120px; 147 | top: -82px; 148 | display: none; 149 | } 150 | .dsj:hover .dsj_block{ 151 | display: block; 152 | } 153 | .loT_block{ 154 | width: 770px; 155 | height: 200px; 156 | background: rgb(240,243,241); 157 | position: absolute; 158 | left: 120px; 159 | top: -123px; 160 | display: none; 161 | } 162 | .loT:hover .loT_block{ 163 | display: block; 164 | } 165 | .rgzn_block{ 166 | width: 770px; 167 | height: 200px; 168 | background: rgb(240,243,241); 169 | position: absolute; 170 | left: 120px; 171 | top: -164px; 172 | display: none; 173 | } 174 | .rgzn:hover .rgzn_block{ 175 | display: block; 176 | } 177 | .ydkf_block{ 178 | width: 770px; 179 | height: 200px; 180 | background: rgb(240,243,241); 181 | position: absolute; 182 | left: 120px; 183 | top: -205px; 184 | display: none; 185 | } 186 | .ydkf:hover .ydkf_block{ 187 | display: block; 188 | } 189 | .jg_block{ 190 | width: 770px; 191 | height: 200px; 192 | background: rgb(240,243,241); 193 | position: absolute; 194 | left: 120px; 195 | top: -246px; 196 | display: none; 197 | } 198 | .yj:hover,.yjs:hover,.dsj:hover,.loT:hover,.rgzn:hover,.ydkf:hover,.jg:hover{ 199 | color: #B50000; 200 | } 201 | .jg:hover .jg_block{ 202 | display: block; 203 | } 204 | .yj_block a{ 205 | width: 24.7%; 206 | height: 33%; 207 | float: left; 208 | border-right: 1px solid #AAAAAA; 209 | border-bottom: 1px solid #AAAAAA; 210 | } 211 | .yjs_block a{ 212 | width: 24.7%; 213 | height: 19.4%; 214 | float: left; 215 | border-right: 1px solid #AAAAAA; 216 | border-bottom-width:100%; 217 | border-bottom: 1px solid #AAAAAA; 218 | } 219 | .dsj_block a{ 220 | width: 24.7%; 221 | height: 19.4%; 222 | float: left; 223 | border-right: 1px solid #AAAAAA; 224 | border-bottom: 1px solid #AAAAAA; 225 | } 226 | .loT_block a{ 227 | width: 24.7%; 228 | height: 19.4%; 229 | float: left; 230 | border-right: 1px solid #AAAAAA; 231 | border-bottom: 1px solid #AAAAAA; 232 | } 233 | .rgzn_block a{ 234 | width: 24.7%; 235 | height: 19.4%; 236 | float: left; 237 | border-right: 1px solid #AAAAAA; 238 | border-bottom: 1px solid #AAAAAA; 239 | } 240 | .ydkf_block a{ 241 | width: 24.7%; 242 | height: 19.4%; 243 | float: left; 244 | border-right: 1px solid #AAAAAA; 245 | border-bottom: 1px solid #AAAAAA; 246 | } 247 | .jg_block a{ 248 | width: 24.7%; 249 | height: 19.4%; 250 | float: left; 251 | border-right: 1px solid #AAAAAA; 252 | border-bottom: 1px solid #AAAAAA; 253 | } 254 | .content_middle{ 255 | width: 770px; 256 | height: 100%; 257 | float: left; 258 | border: 1px solid #AAAAAA; 259 | } 260 | .content_middle_inner{ 261 | width: 95%; 262 | height: 100%; 263 | margin: 0 auto; 264 | } 265 | .content_middle_inner_title{ 266 | width: 100%; 267 | height: 43px; 268 | line-height: 43px; 269 | font-size: 20px; 270 | font-weight: bold; 271 | } 272 | .content_middle_inner_banner{ 273 | width: 100%; 274 | height: 25px; 275 | line-height: 25px; 276 | font-size: 13px; 277 | background: #EAEEF0; 278 | border-top: 1px solid #AAAAAA; 279 | color: #B50000; 280 | } 281 | .content_middle_inner_banner:hover{ 282 | text-decoration: underline; 283 | } 284 | .content_middle_inner_banner span{ 285 | font-weight: bold; 286 | } 287 | .content_middle_inner_line1{ 288 | width: 100%; 289 | height: 25px; 290 | line-height: 25px; 291 | font-size: 12px; 292 | border-bottom: 1px dashed #DDDDDD; 293 | } 294 | .content_middle_inner_line1 span{ 295 | color: #B50000; 296 | } 297 | .content_middle_inner_line1 span:hover{ 298 | text-decoration: underline; 299 | } 300 | .content_right{ 301 | width: 274px; 302 | height: 100%; 303 | border: 1px solid #AAAAAA; 304 | float: left; 305 | } 306 | .content_right_inner{ 307 | width: 85%; 308 | height: 100%; 309 | margin: 0 auto; 310 | } 311 | .content_right_inner_banner{ 312 | width: 100%; 313 | height: 25px; 314 | line-height: 25px; 315 | font-size: 13px; 316 | background: #EAEEF0; 317 | border-top: 1px solid #AAAAAA; 318 | color: #B50000; 319 | margin-top: 43px; 320 | font-weight: bold; 321 | } 322 | .content_right_inner_banner:hover{ 323 | text-decoration: underline; 324 | } 325 | .content_right ul{ 326 | width: 100%; 327 | height: 25px; 328 | color: #B50000; 329 | line-height: 25px; 330 | font-size: 13px; 331 | border-bottom: 1px solid #D5D5D5; 332 | } 333 | .content_right ul:hover{ 334 | text-decoration: underline; 335 | } 336 | .content_right li{ 337 | width: 74px; 338 | height: 25px; 339 | line-height: 25px; 340 | font-size: 13px; 341 | float: left; 342 | list-style: none; 343 | padding-left: 0; 344 | border-bottom: 1px dashed #DDDDDD; 345 | /*margin-left: 5px;*/ 346 | } 347 | .content_right li:hover{ 348 | color: #B50000; 349 | text-decoration: underline; 350 | } 351 | .content_right_inner_footer{ 352 | clear: both; 353 | text-align: right; 354 | font-size: 13px; 355 | line-height: 25px; 356 | margin-right: 10px; 357 | } 358 | .content_right_inner_footer:hover{ 359 | color: #B50000; 360 | text-decoration: underline; 361 | } 362 | .footer{ 363 | width: 1200px; 364 | height: 130px; 365 | margin: 20px auto; 366 | border-top: 1px solid #E5E5E5; 367 | } 368 | .footer_line_1{ 369 | line-height: 25px; 370 | text-align: center; 371 | font-size: 13px; 372 | } 373 | .footer_line_2{ 374 | text-align: center; 375 | font-size: 12px; 376 | line-height: 25px; 377 | } 378 | .footer_img{ 379 | display: block; 380 | margin: 20px auto; 381 | } -------------------------------------------------------------------------------- /WebContent/static/css/board2.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | ul{ 6 | margin: 0; 7 | padding: 0; 8 | } 9 | 10 | a:link { text-decoration: none; color: red;}  11 |    a:hover { text-decoration:underline; color: red;} 12 |    a:visited { text-decoration: none; color: red;} 13 | 14 | .head{ 15 | width: 100%; 16 | height: 20px; 17 | position: absolute; 18 | z-index: 5; 19 | top: 0; 20 | text-align: right; 21 | border-bottom: 1px solid #E3E3E3; 22 | font-size: 15px; 23 | } 24 | .head span{ 25 | color: #999999; 26 | } 27 | .register{ 28 | background: #0073BA; 29 | color: white; 30 | text-decoration: none; 31 | } 32 | .register:hover{ 33 | opacity: 0.8; 34 | } 35 | .login{ 36 | text-decoration: none; 37 | padding-right: 85px; 38 | } 39 | .login:hover{ 40 | text-decoration: underline; 41 | } 42 | .banner{ 43 | width: 1200px; 44 | height: 155px; 45 | margin: 30px auto; 46 | } 47 | .banner img{ 48 | margin-top: 15px; 49 | float: left; 50 | } 51 | .banner_top{ 52 | width: 1005px; 53 | height: 28px; 54 | line-height: 28px; 55 | float: left; 56 | margin-left: 5px; 57 | margin-top: 10px; 58 | background: #A41F24; 59 | border-top: 1px solid #C24A52; 60 | border-right: #C24A52; 61 | } 62 | .banner_top li{ 63 | float: left; 64 | list-style: none; 65 | margin-left: 10px; 66 | padding-right: 5px; 67 | color: white; 68 | border-right: 1px solid #8E0D12; 69 | font-family: 黑体; 70 | } 71 | .banner_top li:hover{ 72 | text-decoration: underline; 73 | } 74 | .banner_middle{ 75 | width: 1005px; 76 | height: 28px; 77 | line-height: 28px; 78 | float: left; 79 | margin-left: 5px; 80 | background: #E3E7EB; 81 | } 82 | .banner_middle li{ 83 | list-style: none; 84 | float: left; 85 | padding-right: 5px; 86 | border-right: 1px solid #D0D0D1; 87 | margin-left: 10px; 88 | font-family: 黑体; 89 | font-size: 15px; 90 | color: #444444; 91 | } 92 | .content{ 93 | width: 1200px; 94 | height: 330px; 95 | margin: 0 auto; 96 | } 97 | .content_left{ 98 | width: 150px; 99 | height: 100%; 100 | float: left; 101 | background: #ECF1F4; 102 | border: 1px solid #AAAAAA; 103 | } 104 | .content_left>div{ 105 | width: 120px;; 106 | height: 40px; 107 | line-height: 40px; 108 | border-bottom: 1px solid white; 109 | margin-left: 30px; 110 | position: relative; 111 | background: #ECF1F4; 112 | } 113 | .bkfl{ 114 | color: red; 115 | font-weight: bold; 116 | } 117 | .yj_block{ 118 | width: 770px; 119 | height: 100px; 120 | background: rgb(240,243,241); 121 | position: absolute; 122 | left: 120px; 123 | top: 0; 124 | display: none; 125 | } 126 | .yj:hover .yj_block{ 127 | display: block; 128 | } 129 | .yjs_block{ 130 | width: 770px; 131 | height: 200px; 132 | background: rgb(240,243,241); 133 | position: absolute; 134 | left: 120px; 135 | top: -41px; 136 | display: none; 137 | } 138 | .yjs:hover .yjs_block{ 139 | display: block; 140 | } 141 | .dsj_block{ 142 | width: 770px; 143 | height: 200px; 144 | background: rgb(240,243,241); 145 | position: absolute; 146 | left: 120px; 147 | top: -82px; 148 | display: none; 149 | } 150 | .dsj:hover .dsj_block{ 151 | display: block; 152 | } 153 | .loT_block{ 154 | width: 770px; 155 | height: 200px; 156 | background: rgb(240,243,241); 157 | position: absolute; 158 | left: 120px; 159 | top: -123px; 160 | display: none; 161 | } 162 | .loT:hover .loT_block{ 163 | display: block; 164 | } 165 | .rgzn_block{ 166 | width: 770px; 167 | height: 200px; 168 | background: rgb(240,243,241); 169 | position: absolute; 170 | left: 120px; 171 | top: -164px; 172 | display: none; 173 | } 174 | .rgzn:hover .rgzn_block{ 175 | display: block; 176 | } 177 | .ydkf_block{ 178 | width: 770px; 179 | height: 200px; 180 | background: rgb(240,243,241); 181 | position: absolute; 182 | left: 120px; 183 | top: -205px; 184 | display: none; 185 | } 186 | .ydkf:hover .ydkf_block{ 187 | display: block; 188 | } 189 | .jg_block{ 190 | width: 770px; 191 | height: 200px; 192 | background: rgb(240,243,241); 193 | position: absolute; 194 | left: 120px; 195 | top: -246px; 196 | display: none; 197 | } 198 | .yj:hover,.yjs:hover,.dsj:hover,.loT:hover,.rgzn:hover,.ydkf:hover,.jg:hover{ 199 | color: #B50000; 200 | } 201 | .jg:hover .jg_block{ 202 | display: block; 203 | } 204 | .yj_block a{ 205 | width: 24.7%; 206 | height: 33%; 207 | float: left; 208 | border-right: 1px solid #AAAAAA; 209 | border-bottom: 1px solid #AAAAAA; 210 | } 211 | .yjs_block a{ 212 | width: 24.7%; 213 | height: 19.4%; 214 | float: left; 215 | border-right: 1px solid #AAAAAA; 216 | border-bottom-width:100%; 217 | border-bottom: 1px solid #AAAAAA; 218 | } 219 | .dsj_block a{ 220 | width: 24.7%; 221 | height: 19.4%; 222 | float: left; 223 | border-right: 1px solid #AAAAAA; 224 | border-bottom: 1px solid #AAAAAA; 225 | } 226 | .loT_block a{ 227 | width: 24.7%; 228 | height: 19.4%; 229 | float: left; 230 | border-right: 1px solid #AAAAAA; 231 | border-bottom: 1px solid #AAAAAA; 232 | } 233 | .rgzn_block a{ 234 | width: 24.7%; 235 | height: 19.4%; 236 | float: left; 237 | border-right: 1px solid #AAAAAA; 238 | border-bottom: 1px solid #AAAAAA; 239 | } 240 | .ydkf_block a{ 241 | width: 24.7%; 242 | height: 19.4%; 243 | float: left; 244 | border-right: 1px solid #AAAAAA; 245 | border-bottom: 1px solid #AAAAAA; 246 | } 247 | .jg_block a{ 248 | width: 24.7%; 249 | height: 19.4%; 250 | float: left; 251 | border-right: 1px solid #AAAAAA; 252 | border-bottom: 1px solid #AAAAAA; 253 | } 254 | .content_middle{ 255 | width: 1046px; 256 | height: 100%; 257 | float: left; 258 | border: 1px solid #AAAAAA; 259 | } 260 | .content_middle_inner{ 261 | width: 95%; 262 | height: 100%; 263 | margin: 0 auto; 264 | } 265 | .content_middle_inner_title{ 266 | width: 100%; 267 | height: 43px; 268 | line-height: 43px; 269 | font-size: 20px; 270 | font-weight: bold; 271 | } 272 | .content_middle_inner_banner{ 273 | width: 100%; 274 | height: 25px; 275 | line-height: 25px; 276 | font-size: 13px; 277 | background: #EAEEF0; 278 | border-top: 1px solid #AAAAAA; 279 | color: #B50000; 280 | } 281 | .content_middle_inner_banner:hover{ 282 | text-decoration: underline; 283 | } 284 | .content_middle_inner_banner span{ 285 | font-weight: bold; 286 | } 287 | .content_middle_inner_line1{ 288 | width: 100%; 289 | height: 25px; 290 | line-height: 25px; 291 | font-size: 12px; 292 | border-bottom: 1px dashed #DDDDDD; 293 | } 294 | .content_middle_inner_line1 span{ 295 | color: #B50000; 296 | } 297 | .content_middle_inner_line1 span:hover{ 298 | text-decoration: underline; 299 | } 300 | .content_right{ 301 | width: 274px; 302 | height: 100%; 303 | border: 1px solid #AAAAAA; 304 | float: left; 305 | } 306 | .content_right_inner{ 307 | width: 85%; 308 | height: 100%; 309 | margin: 0 auto; 310 | } 311 | .content_right_inner_banner{ 312 | width: 100%; 313 | height: 25px; 314 | line-height: 25px; 315 | font-size: 13px; 316 | background: #EAEEF0; 317 | border-top: 1px solid #AAAAAA; 318 | color: #B50000; 319 | margin-top: 43px; 320 | font-weight: bold; 321 | } 322 | .content_right_inner_banner:hover{ 323 | text-decoration: underline; 324 | } 325 | .content_right ul{ 326 | width: 100%; 327 | height: 25px; 328 | color: #B50000; 329 | line-height: 25px; 330 | font-size: 13px; 331 | border-bottom: 1px solid #D5D5D5; 332 | } 333 | .content_right ul:hover{ 334 | text-decoration: underline; 335 | } 336 | .content_right li{ 337 | width: 74px; 338 | height: 25px; 339 | line-height: 25px; 340 | font-size: 13px; 341 | float: left; 342 | list-style: none; 343 | padding-left: 0; 344 | border-bottom: 1px dashed #DDDDDD; 345 | /*margin-left: 5px;*/ 346 | } 347 | .content_right li:hover{ 348 | color: #B50000; 349 | text-decoration: underline; 350 | } 351 | .content_right_inner_footer{ 352 | clear: both; 353 | text-align: right; 354 | font-size: 13px; 355 | line-height: 25px; 356 | margin-right: 10px; 357 | } 358 | .content_right_inner_footer:hover{ 359 | color: #B50000; 360 | text-decoration: underline; 361 | } 362 | .footer{ 363 | width: 1000px; 364 | height: 130px; 365 | margin: 20px auto; 366 | border-top: 1px solid #E5E5E5; 367 | } 368 | .footer_line_1{ 369 | line-height: 25px; 370 | text-align: center; 371 | font-size: 13px; 372 | } 373 | .footer_line_2{ 374 | text-align: center; 375 | font-size: 12px; 376 | line-height: 25px; 377 | } 378 | .footer_img{ 379 | display: block; 380 | margin: 20px auto; 381 | } -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/listAllBoards.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | 5 | 6 | 7 | 8 | 9 | 论坛首页 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <%@ include file="includeTop.jsp"%> 18 | 19 | <%-- 20 | 21 | 22 | 23 | 24 | 25 | 26 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 52 | 53 | 54 | 55 | 56 |
所有论坛版块
版块名称版块简介主题帖数
">${board.boardName}${board.boardDesc}${board.topicNum}
--%> 57 | 58 | 59 | 100 |
101 |
102 |
版块分类
103 |
104 | 业界 105 |
106 | 108 | 109 | 110 | <%-- 111 | 113 | --%> 114 | ">${board.boardName} 116 | 117 | 118 | 119 |
120 |
121 | 133 | 145 | 157 | 169 | 181 | 193 |
194 |
195 |
196 |
CSDN论坛热帖
197 |
198 | 业界论坛 亮回贴 199 |
200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 236 | 237 | 239 | 240 | 241 | 242 | 243 |
版块名称版块简介主题帖数
">${board.boardName}${board.boardDesc}${board.topicNum}
244 | 245 | 246 | 247 |
248 |
249 |
250 |
251 |
板块列表
252 | 253 |
    业界论坛 254 |
255 |
  • PHP
  • 256 |
  • JavaScript
  • 257 |
  • ASP
  • 258 |
  • HTML(CSS)
  • 259 |
  • VC/MFC
  • 260 |
  • 移动开发
  • 261 |
  • .NET技术
  • 262 |
  • Hadoop
  • 263 |
  • VB
  • 264 |
  • Apache
  • 265 |
  • 开发语言
  • 266 |
  • C/C++
  • 267 |
  • C++ Builder
  • 268 |
  • Delphi
  • 269 |
  • iOS
  • 270 |
  • Java技术
  • 271 |
  • WP
  • 272 |
  • Pass/SaaS
  • 273 |
  • IaaS
  • 274 |
  • Android
  • 275 |
  • Java EE
  • 276 |
  • VB .NET
  • 277 |
  • Web开发
  • 278 |
  • 云计算
  • 279 | 280 |
    281 |
    282 |
    283 |
    284 |
    285 |
    286 | 294 | 295 | 296 | 324 | 325 | 326 | 327 | 328 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/jsp/listBoardTopics.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> 5 | <%@taglib prefix="baobaotao" tagdir="/WEB-INF/tags"%> 6 | 7 | 8 | 9 | 10 | 论坛版块页面 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <%@ include file="includeTop.jsp"%> 20 | 21 | 62 | 63 | 64 | 65 |
    66 |
    67 |
    版块分类
    68 |
    69 | 业界 70 |
    71 | 72 | 73 | 74 | ">${board.boardName} 76 | 77 | 78 |
    79 |
    80 | 92 | 104 | 116 | 128 | 140 | 152 |
    153 |
    154 |
    155 |
    CSDN论坛热帖
    156 |
    157 | 业界论坛 亮回贴 158 |
    159 |
    160 | 161 | 162 | 163 | 164 | 165 | 166 | 169 | 170 | 171 | 172 | 173 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 206 | 207 | 213 | 215 | 217 | 219 | 221 | 222 | 223 |
    ${board.boardName}">发表新话题 168 |
    标题发表人回复数发表时间最后回复时间
    "> 209 | 210 | 211 | ${topic.topicTitle} 212 | ${topic.user.userName}

    214 |
    ${topic.replies}

    216 |
    224 |
    225 | 228 | 229 | 267 | 268 | 269 | 270 |
    271 |
    272 |
    273 | 281 | 282 | 283 | 284 | <%-- 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 295 | 296 | 298 | 299 | 300 | 301 | 302 |
    ">${board.boardName}${board.boardDesc}${board.topicNum}
    --%> 303 | 304 | 305 | 306 |
    307 |
    308 | 309 |
    310 | 311 | 312 | 313 | 314 | 315 | <%--
    316 | 317 | 318 | 319 | 320 | 321 | 322 | 325 | 326 | 327 | 328 | 329 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 360 | 361 | 367 | 369 | 371 | 373 | 375 | 376 | 377 |
    ${board.boardName}">发表新话题 324 |
    标题发表人回复数发表时间最后回复时间
    "> 363 | 364 | 365 | ${topic.topicTitle} 366 | ${topic.user.userName}

    368 |
    ${topic.replies}

    370 |
    378 |
    379 | 382 | 383 | 417 | 418 | 419 | 420 | --%> 421 | 422 | 423 | 424 | --------------------------------------------------------------------------------