web.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- 引入Spring配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- 加入Spring监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping></web-app>
hibernate.reveng.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<table name="USERTABLE" schema="SCOTT"
class="com.blog.entity.User">
<primary-key>
<key-column name="USERID" property="userId"
type="java.lang.String" />
</primary-key>
<column name="USERPASSWORD" type="java.lang.String"
property="userPassword">
</column>
<column name="USERMAIL" type="java.lang.String"
property="userMail">
</column>
<column name="BLOGINFO" type="java.lang.String"
property="blogInfo">
</column>
<column name="USERHEADPATH" type="java.lang.String"
property="userHeadPath">
</column>
<column name="USERSEX" type="java.lang.String"
property="userSex">
</column>
<column name="USERLINK" type="java.lang.String"
property="userLink">
</column>
<column name="USERBIRTH" type="java.lang.String"
property="userBirth">
</column>
<column name="USERWEB" type="java.lang.String"
property="userWeb">
</column>
</table>
<table name="ARTICLETABLE" schema="SCOTT"
class="com.blog.entity.ArticleTable">
<primary-key>
<key-column name="ARTICLEID" property="articleId"
type="java.lang.String" />
</primary-key>
<column name="TITLE" property="title" type="java.lang.String"></column>
<column name="ARTICLEINFL" property="articleInfl"
type="java.lang.String">
</column>
<column name="USERID" property="userId"
type="com.blog.entity.User">
</column>
<column name="ARTICLETIME" property="articleTime"
type="java.lang.String">
</column>
</table>
<table name="ARTICLECOMMENTTABLE" schema="SCOTT"
class="com.blog.entity.ArtcleCommentTable">
<primary-key>
<key-column name="ARTICLECOMMENTID"
property="articleCommentId" type="java.lang.String" />
</primary-key>
<column name="ARTICLEID" property="articleId"
type="com.blog.entity.ArticleTable">
</column>
<column name="COMMENTINFL" property="commentInfl"
type="java.lang.String">
</column>
<column name="COMMENTERID" property="commenterId"
type="com.blog.entity.User">
</column>
</table>
<table name="ARTICLEREPLYTABLE" schema="SCOTT"
class="com.blog.entity.ArticleReplyTable">
<primary-key>
<key-column name="REPLYID" property="replyId"
type="java.lang.String" />
</primary-key>
<column name="ARTICLECOMMENTID" property="articleCommentId"
type="com.blog.entity.ArticleCommentTable">
</column>
<column name="REPLYINFO" property="replyInfo"
type="java.lang.String">
</column>
<column name="REPLYERID" property="replyerId"
type="com.blog.entity.User">
</column>
</table>
<table name="TAGTABLE" schema="SCOTT"
class="com.blog.entity.TagTable">
<primary-key>
<key-column name="TAGID" property="tagId"
type="java.lang.String" />
</primary-key>
<column name="USERID" property="userId"
type="com.blog.entity.User">
</column>
<column name="TAGNAME" property="tagName"
type="java.lang.String">
</column>
</table>
<table name="IMAGETABLE" schema="SCOTT"
class="com.blog.entity.ImageTable">
<primary-key>
<key-column name="IMAGEID" property="imageId"
type="java.lang.String" />
</primary-key>
<column name="IMAGEBLOGDEC" property="imageBlogDec"
type="java.lang.String">
</column>
<column name="USERID" property="userId"
type="com.blog.entity.User">
</column>
<column name="IMAGETIME" property="imageTime"
type="java.lang.String">
</column>
<column name="IMAGETITLE" property="imageTitle"
type="java.lang.String">
</column>
<column name="HEAT" property="heat" type="java.lang.Integer"></column>
<column name="FLAG" property="flag" type="java.lang.String"></column>
<column name="IMAGEPATH" property="imagePath" type="java.lang.String"></column>
</table>
<table name="IMAGECOMMENTTABLE" schema="SCOTT"
class="com.blog.entity.ImageCommentTable">
<primary-key>
<key-column name="IMAGECOMMENTID" property="imageCommentId"
type="java.lang.String" />
</primary-key>
<column name="COMMENTINFL" property="commentInfl"
type="java.lang.String">
</column>
<column name="COMMENTERID" property="commenterId"
type="com.blog.entity.User">
</column>
<column name="IMAGEID" property="imageId"
type="com.blog.entity.ImageTable">
</column>
</table>
<table name="IMAGEREPLYTABLE" schema="SCOTT"
class="com.blog.entity.ImageReplyTable">
<primary-key>
<key-column name="REPLYID" property="replyId"
type="java.lang.String" />
</primary-key>
<column name="IMAGECOMMENTID" property="imageCommentId"
type="com.blog.entity.ImageCommentTable">
</column>
<column name="REPLYINFO" property="replyInfo"
type="java.lang.String">
</column>
<column name="REPLYERID" property="replyerId"
type="com.blog.entity.User">
</column>
</table>
<table name="PHOTOINFOTABLE" schema="SCOTT"
class="com.blog.entity.PhotoInfoTable">
<primary-key>
<key-column name="PHOTOID" property="photoId"
type="java.lang.String" />
</primary-key>
<column name="PHOTODEC" property="photoDec"
type="java.lang.String">
</column>
<column name="IMAGEID" property="imageId"
type="com.blog.entity.ImageTable">
</column>
<column name="IMAGEPATH" property="imagePath"
type="java.lang.String">
</column>
</table>
<table name="CONTACTTABLE" schema="SCOTT"
class="com.blog.entity.ContactTable">
<primary-key>
<key-column name="CONTACTID" property="contactId"
type="java.lang.String" />
</primary-key>
<column name="CONTACTERID" property="contacterId"
type="com.blog.entity.User">
</column>
<column name="CONTACTEDID" property="contactedId"
type="com.blog.entity.User">
</column>
</table>
<table name="ARTICLETAGTABLE" schema="SCOTT"
class="com.blog.entity.ArticleTagTable">
<primary-key>
<key-column name="ARTICLETAGID" property="articleTagId"
type="java.lang.String" />
</primary-key>
<column name="TAGID" property="tagId"
type="com.blog.entity.TagTable">
</column>
<column name="ARTICLEID" property="articleId"
type="com.blog.entity.ArticleTable">
</column>
</table>
<table name="TAGIMAGETABLE" schema="SCOTT"
class="com.blog.entity.TagImageTable">
<primary-key>
<key-column name="TAGIMAGEID" property="tagImageId"
type="java.lang.String" />
</primary-key>
<column name="TAGNAME" property="tagName"
type="java.lang.String">
</column>
<column name="IMAGEID" property="imageId"
type="com.blog.entity.ImageTable">
</column>
</table>
<table name="USERTAGTABLE" schema="SCOTT"
class="com.blog.entity.UserTagTable">
<primary-key>
<key-column name="USERTAGID" property="userTagId"
type="java.lang.String" />
</primary-key>
<column name="USERID" property="userId"
type="com.blog.entity.User">
</column>
<column name="TAGNAME" property="tagName"
type="java.lang.String">
</column>
</table>
</hibernate-reverse-engineering>
applicationContext.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url" value="jdbc:oracle:thin:@localhost:1521:yzl">
</property>
<property name="username" value="scott"></property>
<property name="password" value="scott"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/blog/entity/User.hbm.xml</value>
<value>com/blog/entity/ArticleTable.hbm.xml</value>
<value>
com/blog/entity/ArticleCommentTable.hbm.xml
</value>
<value>com/blog/entity/ArticleReplyTable.hbm.xml</value>
<value>com/blog/entity/TagTable.hbm.xml</value>
<value>com/blog/entity/ImageTable.hbm.xml</value>
<value>com/blog/entity/ImageCommentTable.hbm.xml</value>
<value>com/blog/entity/ImageReplyTable.hbm.xml</value>
<value>com/blog/entity/PhotoInfoTable.hbm.xml</value>
<value>com/blog/entity/ContactTable.hbm.xml</value>
<value>com/blog/entity/ArticleTagTable.hbm.xml</value>
<value>com/blog/entity/TagImageTable.hbm.xml</value>
<value>com/blog/entity/UserTagTable.hbm.xml</value></list>
</property>
</bean>
<bean id="userTagDao" class="com.blog.dao.jdbc.UserTagImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="userDao" class="com.blog.dao.jdbc.UserImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="tagDao" class="com.blog.dao.jdbc.TagImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="articleDao" class="com.blog.dao.jdbc.ArticleImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="articleTagDao" class="com.blog.dao.jdbc.ArticleTagImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="imageDao" class="com.blog.dao.jdbc.ImageImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="tagImageDao" class="com.blog.dao.jdbc.TagImageImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="imageCommentDao" class="com.blog.dao.jdbc.ImageCommentImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="thumbsUpDao" class="com.blog.dao.jdbc.ThumbsUpDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="adminDao" class="com.blog.dao.jdbc.AdminImpl">
<property name="sessionFactory" ref="sessionFactory"> </property>
</bean>
<bean id="adminArticleDao" class="com.blog.dao.jdbc.AdminArticleImpl">
<property name="sessionFactory" ref="sessionFactory"> </property>
</bean>
<bean id="contactDao" class="com.blog.dao.jdbc.ContactImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="userTagService" class="com.blog.service.spring.UserTagServiceSpring">
<property name="userTagDao" ref="userTagDao"></property>
</bean>
<bean id="userService" class="com.blog.service.spring.UserServiceSpringImpl">
<property name="userDao" ref="userDao"></property>
</bean>
<bean id="tagService" class="com.blog.service.spring.TagServiceSpringImpl">
<property name="tagDao" ref="tagDao"></property>
</bean>
<bean id="articleService" class="com.blog.service.spring.ArticleServiceSpring">
<property name="articleDao" ref="articleDao"></property>
</bean>
<bean id="articleTagService" class="com.blog.service.spring.ArticleTagServiceSpring">
<property name="articleTagDao" ref="articleTagDao"></property>
</bean>
<bean id="imageService" class="com.blog.service.spring.ImageServiceSpring">
<property name="imageDao" ref="imageDao"></property>
<property name="tagImageService" ref="tagImageService"></property>
</bean>
<bean id="tagImageService" class="com.blog.service.spring.TagImageServiceSpring">
<property name="tagImageDao" ref="tagImageDao"></property>
</bean>
<bean id="imageCommentService" class="com.blog.service.spring.ImageCommentServiceSpringImpl" >
<property name="imageCommentDao" ref="imageCommentDao"></property>
</bean>
<bean id="thumbsUpService" class="com.blog.service.spring.ThumbsUpServiceSpringImpl" >
<property name="thumbsUpDao" ref="thumbsUpDao"></property>
</bean>
<bean id="adminService" class="com.blog.service.spring.AdminServiceSpringImpl">
<property name="adminDao" ref="adminDao"></property>
</bean>
<bean id="adminArticleService" class="com.blog.service.spring.AdminArticleServiceSpringImpl">
<property name="adminArticleDao" ref="adminArticleDao"></property>
</bean>
<bean id="contactService" class="com.blog.service.spring.ContactSpringImpl" >
<property name="contactDao" ref="contactDao"></property>
</bean>
<bean id="userAction" class="com.blog.action.UserAction">
<property name="userService" ref="userService"></property>
<property name="userTagService" ref="userTagService"></property>
<property name="contactService" ref="contactService"></property>
</bean>
<bean id="tagAction" class="com.blog.action.TagAction">
<property name="tagService" ref="tagService"></property>
</bean>
<bean id="articleAction" class="com.blog.action.ArticleAction">
<property name="articleService" ref="articleService"></property>
<property name="articleTagService" ref="articleTagService"></property>
</bean>
<bean id="articleTagAction" class="com.blog.action.ArticleTagAction">
<property name="articleTagService" ref="articleTagService"></property>
</bean>
<bean id="imageAction" class="com.blog.action.ImageAction">
<property name="imageService" ref="imageService"></property>
<property name="tagImageService" ref="tagImageService"></property>
<property name="adminArticleService" ref="adminArticleService"></property>
<property name="imageCommentService" ref="imageCommentService"></property>
</bean>
<bean id="adminAction" class="com.blog.action.AdminAction">
<property name="adminService" ref="adminService"></property>
</bean>
<bean id="adminArticleAction" class="com.blog.action.AdminArticleAction">
<property name="adminArticleService" ref="adminArticleService"></property>
<property name="imageService" ref="imageService"></property>
</bean>
<bean id="contactAction" class="com.blog.action.ContactAction">
<property name="contactService" ref="contactService"></property>
</bean>
<!-- Ajax配置 -->
<bean id="thumbsUpAjax" class="com.blog.ajax.ThumbsUpAjax">
<property name="thumbsUpService" ref="thumbsUpService"></property>
</bean>
<bean id="imageCommentAjax" class="com.blog.ajax.ImageCommentAjax">
<!-- <property name="imageService" ref="imageService"></property>
<property name="userService" ref="userService"></property> -->
<property name="imageCommentService" ref="imageCommentService"></property>
</bean>
</beans>
struts.xml配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.action.extension" value="action"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<package name="User" extends="struts-default" namespace="/">
<global-results>
<result name="error">/error.jsp</result>
</global-results>
<action name="user_*" class="userAction" method="{1}">
<result name="contact">/contact.jsp</result>
<result name="manage">/admin.jsp</result>
<result name="mainFrame">/MainFrame.jsp</result>
<result name="login">/login.jsp</result>
<result name="regist">/registerSetting.jsp</result>
<result name="modelFirst">/modelFirst.jsp</result>
<result name="modelSecond">/modelSecond.jsp</result>
<result name="modelThird">/modelThird.jsp</result>
<result name="articleList" type="chain">
<param name="namespace">/</param>
<param name="userWeb">${userWeb}</param>
<param name="actionName">image_queryAll</param>
</result>
<result name="queryFor">/setting.jsp</result>
<!-- <result name="update">/MainFrame.jsp</result> -->
<result name="update" type="chain">
<param name="namespace">/</param>
<param name="actionName">image_queryAll</param>
</result>
</action>
<action name="admin_*" class="adminAction" method="{1}">
<result name="user_query">/userManageResult.jsp</result>
<result name="blog_delete">/blogManageResult.jsp</result>
<result name="user_delete">/userManage.jsp</result>
</action>
<action name="adminArticle_*" class="adminArticleAction" method="{1}">
<result name="article_query">/blogManageResult.jsp</result>
<result name="article_delete">/blogManage.jsp</result>
<result name="inform">/adminInform.jsp</result>
<result name="lookfor">/imageDetail.jsp</result>
<result name="clean">//adminInform.jsp</result>
</action>
<action name="image_*" class="imageAction" method="{1}">
<result name="all" type="chain">
<param name="namespace">/</param>
<param name="userWeb">${userWeb}</param>
<param name="actionName">user_judge</param>
</result>
<result name="titleSearch">/titleMainFrame.jsp</result>
<result name="tagSearch">/tagMainFrame.jsp</result>
<result name="userSearch">/userMainFrame.jsp</result>
<result name="addImage" type="chain">
<param name="namespace">/</param>
<param name="actionName">image_queryAll</param>
</result>
<result name="delete">/userImage.jsp</result>
<result name="userImage">/userImage.jsp</result>
</action>
<!-- ajax配置 -->
<!-- 图片评论 -->
<action name="ImageCommentAjax" class="imageCommentAjax" method="imageCommentAjax"></action>
<!-- 点赞 -->
<action name="ThumbsupAjax" class="thumbsUpAjax" method="thumbsupAjax"></action>
<action name="contact_*" class="contactAction" method="{1}">
<result name="all">/contact.jsp</result>
</action>
</package>
</struts>