关于SSH框架的xml版整合


整合步骤:

一:引入节点

二:搭建分层

三:配置文件

四:web.xml

五:action层

六:UI层

第一步:引入节点(整合节点)


    
      org.apache.struts
      struts2-spring-plugin
      2.3.4.1
    

第二步:搭建分层

第三步:配置文件

applicationContext.xml文件


    
        
        
        
        
    

    
    

    
    
        
        
            
                true
                true
                org.hibernate.dialect.Oracle10gDialect
                org.springframework.orm.hibernate5.SpringSessionContext
            
        
        
        
    

    
    
        
    

    
    
        
    

    
    
         
    

    
    
        
    

    
    

struts.xml文件

<?xml version="1.0" encoding="UTF-8" ?>


    
    
    
        
            /index.jsp
        
    

四:web.xml


  
    contextConfigLocation
    classpath:applicationContext.xml
  


  
    struts
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  
  
    struts
    /*
  

  
  
    org.springframework.web.context.ContextLoaderListener
  

五:action层

public class DeptAction implements Action {

    private Dept dept;
    IDeptService service;

    public String execute() throws Exception {
        service.add(dept);
        return SUCCESS;
    }

    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }

    public IDeptService getService() {
        return service;
    }

    public void setService(IDeptService service) {
        this.service = service;
    }
}

六:UI界面

数据库:

 Tp:SSH框架整合的时候比较容易,只要细心些都是能配出来的。。

相关