建项目时 选择tomcat running time 这样建成后有
Hibernate 4.1.4(勾选core)
Spring 4.1.0 Facets里 选择一个Module
其它 全选
Struts 2.1
Core 不选第一个
Facets 选最新的spring
选择 struts和spring 兼容 的jar包
记得添加mysql的jar包
将 applicationContext.xml struts.xml log4j.properties web.xml
放在指定位置 修改 连接数据库 信息 及 包名 即可
@ParentPackage("default")
@Namespace("/")
@Scope("prototype")
public class BaseAction extends ActionSupport {
@Scope("prototype")
@Component
@Action(value = "ArticleAction", results = {
@Result(name = "addArticleUI", location = "/jsp/adminArticle/addArticleUI.jsp"),
@Result(name = "editeSave", location = "ArticleAction!articleManager.action",type="redirectAction"),
})
public class ArticleAction extends BaseAction {
@Repository("articleDao")
public class ArticleDao extends BaseDao<TArticle> {
@Entity
@Table(name="ARTICLE"
,schema="cgowl"
)
public class TArticle implements java.io.Serializable{
@Controller("articleService")
public class ArticleService implements IArticleService{