ssh框架

建项目时 选择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{

 

 

@Id
@Column(name="ART_ID", unique=true, nullable=false)

 

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="ART_UID")

 

private Set<TArticle> TArticles = new HashSet<TArticle>(0);

@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="tcolumn")

 

 

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>

 

 

<link type="text/css" href="css/bootstrap.min.css" rel="stylesheet">

 

<script type="text/javascript" src="js/jquery-2.1.1.min.js" ></script>

posted @ 2016-07-08 23:02  ihaveadream  阅读(119)  评论(0编辑  收藏  举报