BOS1

maven搭配过程

  (1)parent---domain---dao--service---web。依次向上依赖。

    parent

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.zero.bos</groupId>
  <artifactId>bos-parent</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  
  
 <properties>
      <spring.version>3.2.12.RELEASE</spring.version>
      <spring.datajpa.version>1.4.1.RELEASE</spring.datajpa.version>
      <hibernate.version>3.6.10.Final</hibernate.version>
      <slf4j.version>1.7.5</slf4j.version>
      <c3p0.version>0.9.1.2</c3p0.version>
      <mysql.version>5.0.8</mysql.version>
      <struts2.version>2.3.15.3</struts2.version>
      <servlet.version>2.5</servlet.version>
      <jsp.version>2.0</jsp.version>
      <junit.version>4.11</junit.version>
      <!-- 反向生成实体类 -->
      <hibernate-tools.version>3.2.4.GA</hibernate-tools.version>
        <poi.version>3.9</poi.version>
        <hibernate-search.version>3.4.2.Final</hibernate-search.version> 
        <shiro.version>1.2.2</shiro.version> 
        <ehcache.version>2.6.6</ehcache.version>
  </properties>
  <dependencyManagement>
  
  <dependencies>
  <!-- spring -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>${spring.version}</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-aspects</artifactId>
          <version>${spring.version}</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
          <version>${spring.version}</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
          <version>${spring.version}</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
          <version>${spring.version}</version>
      </dependency>
      <!-- spring data jpa -->
      <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>${spring.datajpa.version}</version>
    </dependency>
    <!-- hibernate -->
      <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-core</artifactId>
          <version>${hibernate.version}</version>
      </dependency>
      <!-- spring  data jpa 依赖jar  -->
      <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-entitymanager</artifactId>
          <version>${hibernate.version}</version>
      </dependency>
      <!-- 日志 -->
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>${slf4j.version}</version>
      </dependency>
      <dependency>
          <groupId>c3p0</groupId>
          <artifactId>c3p0</artifactId>
          <version>${c3p0.version}</version>
      </dependency>
<!--       <dependency> -->
<!--           <groupId>com.oracle</groupId> -->
<!--           <artifactId>ojdbc14</artifactId> -->
<!--           <version>${oracle.version}</version> -->
<!--         <scope>runtime</scope> -->
<!--       </dependency> -->

      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>${mysql.version}</version>
          <scope>runtime</scope>
      </dependency>

<!-- struts2 -->
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-core</artifactId>
          <version>${struts2.version}</version>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-spring-plugin</artifactId>
          <version>${struts2.version}</version>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-json-plugin</artifactId>
          <version>${struts2.version}</version>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-convention-plugin</artifactId>
          <version>${struts2.version}</version>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>${servlet.version}</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jsp-api</artifactId>
          <version>${jsp.version}</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>${junit.version}</version>
          <scope>test</scope>
      </dependency>
      <!-- maven 反向生成实体类 -->
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools</artifactId>
            <version>${hibernate-tools.version}</version>
        </dependency>
      <!-- apache poi 解析 -->

            <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>${poi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${poi.version}</version>
        </dependency>
    <!-- pinyin4j -->
<!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
                <dependency>
                    <groupId>com.belerweb</groupId>
                    <artifactId>pinyin4j</artifactId>
                    <version>2.5.0</version>
                </dependency>

        <!-- flexjson 对象序列化 -->
        <dependency>
            <groupId>net.sf.flexjson</groupId>
            <artifactId>flexjson</artifactId>
            <version>2.0</version>
        </dependency>
        
        <!-- restful 客户端 -->
            <!-- 使用CXF RS开发 -->
          <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>3.0.1</version>
        </dependency>
     
         <!-- 内置jetty web服务器 -->
<!--         <dependency> -->
<!--             <groupId>org.apache.cxf</groupId> -->
<!--             <artifactId>cxf-rt-transports-http-jetty</artifactId> -->
<!--             <version>3.0.1</version> -->
<!--         </dependency> -->

        
        <!-- 使用rs客户端  -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-client</artifactId>
            <version>3.0.1</version>
        </dependency>
        
        <!-- 在CXF扩展提供者,提供转换json接口  -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-extension-providers</artifactId>
            <version>3.0.1</version>
        </dependency>

        <!-- cxf 扩展提供者 转换json 默认需求一个工具包  -->
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.3.7</version>
        </dependency>


   <!-- hibernate search -->
   <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search</artifactId>
            <version>${hibernate-search.version}</version>
        </dependency>
   

   <!-- ik分词器 -->
        <dependency>
            <groupId>cn.itcast.ik.itcast35</groupId>
            <artifactId>itcast35ik</artifactId>
            <version>5.1.1</version>
        </dependency>
        
        <!-- shiro -->

        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-all</artifactId>
            <version>${shiro.version}</version>
        </dependency>
        <!-- itext pdf -->
         <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>itext</artifactId>
            <version>4.2.1</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-asian</artifactId>
            <version>5.2.0</version>
        </dependency>
        
        <!-- jfreechart -->
        <!-- https://mvnrepository.com/artifact/jfree/jfreechart -->
            <dependency>
                <groupId>jfree</groupId>
                <artifactId>jfreechart</artifactId>
                <version>1.0.9</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/jfree/jcommon -->
            <dependency>
                <groupId>jfree</groupId>
                <artifactId>jcommon</artifactId>
                <version>1.0.9</version>
            </dependency>
              <!-- 插件包 -->
            <!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-jfreechart-plugin -->
            <dependency>
                <groupId>org.apache.struts</groupId>
                <artifactId>struts2-jfreechart-plugin</artifactId>
                <version>${struts2.version}</version>
           </dependency>
        
        <!-- jasper -->
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.2.0</version>
        </dependency>

        <!-- jasperreport -->
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>5.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.lowagie</groupId>
                    <artifactId>itext</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
<!-- spring cache  shiro  cache  缓存 -->
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <version>${ehcache.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
  </dependencies>
    </dependencyManagement>
  
  
  <build>
  <pluginManagement>
     <plugins>
             <!-- hibernate tools 插件 -->
      <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <components>
                        <component>
                           <!-- 命令 可以生成实体类对应映射文件  User.hbm.xml -->
                            <name>hbm2hbmxml</name>
                            <implementation>jdbcconfiguration</implementation>
                            <!-- 文件输出位置 -->
                            <outputDirectory>target/generated-resources/hibernate</outputDirectory>
                        </component>
                        <component>
                          <!-- 命令 生成实体类的 但是不会生成注解的 -->
                            <name>hbm2java</name>
                            <implementation>jdbcconfiguration</implementation>
                            <outputDirectory>target/generated-sources/hibernate</outputDirectory>
                        </component>
                    </components>
                    <componentProperties>
                       <!-- 该配置文件必须存放该目录下 作用: 根据表生成实体类   定义实体类生成规范   -->
                        <revengfile>src/main/resources/reveng.xml</revengfile>
                        <!--  hibernate.properties 文件 插件需要连接数据库 配置信息 -->
                        <propertyfile>src/main/resources/hibernate.properties</propertyfile>
                        <!-- 生成实体类默认生成包名 -->
                        <packagename>cn.itcast.mavenbos.domain</packagename>
                        <jdk5>true</jdk5>
                        <!-- true  生成注解  /false  没有注解   -->
                        <ejb3>true</ejb3>
                    </componentProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>cglib</groupId>
                        <artifactId>cglib-nodep</artifactId>
                        <version>2.2.2</version>
                    </dependency>
                     <dependency>
                          <groupId>mysql</groupId>
                          <artifactId>mysql-connector-java</artifactId>
                          <version>${mysql.version}</version>
                          <scope>runtime</scope>
                      </dependency>
                </dependencies>
            </plugin>
      <!-- tomcat 插件 -->
          <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <version>2.1</version>
              <configuration>
              <port>80</port>
              </configuration>
          </plugin>
     </plugins>
  </pluginManagement>
      <plugins>
              <!-- java编译插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
      </plugins>
  </build>
  <modules>
      <module>bos-domain</module>
      <module>bos-utils</module>
      <module>bos-dao</module>
      <module>bos-service</module>
      <module>bos-web</module>
  </modules>
</project>
View Code

  domain

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.zero.bos</groupId>
    <artifactId>bos-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <artifactId>bos-domain</artifactId>
  
  <dependencies>
       <!-- spring -->
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-aspects</artifactId>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-orm</artifactId>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-test</artifactId>
      </dependency>
      <!-- spring data jpa -->
      <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
    </dependency>
    <!-- hibernate -->
      <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-core</artifactId>
      </dependency>
      <!-- spring  data jpa 依赖jar  -->
      <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-entitymanager</artifactId>
      </dependency>
      <!-- 日志 -->
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
      </dependency>
      <dependency>
          <groupId>c3p0</groupId>
          <artifactId>c3p0</artifactId>
      </dependency>
      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <scope>runtime</scope>
      </dependency>
            <!-- hibernate-tools 反向生成实体类 -->
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools</artifactId>
            <version>${hibernate-tools.version}</version>
        </dependency>
  </dependencies>
  
  
  <build>
      <plugins>
          <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <components>
                        <component>
                           <!-- 命令 可以生成实体类对应映射文件  User.hbm.xml -->
                            <name>hbm2hbmxml</name>
                            <implementation>jdbcconfiguration</implementation>
                            <!-- 文件输出位置 -->
                            <outputDirectory>target/generated-resources/hibernate</outputDirectory>
                        </component>
                        <component>
                          <!-- 命令 生成实体类的 但是不会生成注解的 -->
                            <name>hbm2java</name>
                            <implementation>jdbcconfiguration</implementation>
                            <outputDirectory>target/generated-sources/hibernate</outputDirectory>
                        </component>
                    </components>
                    <componentProperties>
                       <!-- 该配置文件必须存放该目录下 作用: 根据表生成实体类   定义实体类生成规范   -->
                        <revengfile>src/main/resources/reveng.xml</revengfile>
                        <!--  hibernate.properties 文件 插件需要连接数据库 配置信息 -->
                        <propertyfile>src/main/resources/hibernate.properties</propertyfile>
                        <!-- 生成实体类默认生成包名 -->
                        <packagename>cn.itcast.mavenbos.domain</packagename>
                        <jdk5>true</jdk5>
                        <!-- true  生成注解  /false  没有注解   -->
                        <ejb3>true</ejb3>
                    </componentProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>cglib</groupId>
                        <artifactId>cglib-nodep</artifactId>
                        <version>2.2.2</version>
                    </dependency>
                     <dependency>
                          <groupId>mysql</groupId>
                          <artifactId>mysql-connector-java</artifactId>
                          <scope>runtime</scope>
                      </dependency>
                </dependencies>
            </plugin>
      </plugins>
  </build>
  
</project>
View Code

dao

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.zero.bos</groupId>
        <artifactId>bos-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>bos-dao</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.zero.bos</groupId>
            <artifactId>bos-domain</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
    
</project>
View Code

service

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.zero.bos</groupId>
        <artifactId>bos-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>bos-service</artifactId>
    
    <dependencies>
        <dependency>
            <groupId>com.zero.bos</groupId>
            <artifactId>bos-dao</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
    
</project>
View Code

web

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.zero.bos</groupId>
        <artifactId>bos-parent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>bos-web</artifactId>
    <packaging>war</packaging>


    <dependencies>
        <dependency>
            <groupId>com.zero.bos</groupId>
            <artifactId>bos-service</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        
        
    <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-web</artifactId>
      </dependency>
    
        <!-- struts2 -->
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-core</artifactId>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-spring-plugin</artifactId>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-json-plugin</artifactId>
      </dependency>
      <dependency>
          <groupId>org.apache.struts</groupId>
          <artifactId>struts2-convention-plugin</artifactId>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jsp-api</artifactId>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <scope>test</scope>
      </dependency>
    </dependencies>
    
    <build>
        <plugins>
                  <!-- tomcat 插件 -->
          <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
              <configuration>
              <port>80</port>
              </configuration>
          </plugin>
        </plugins>
    </build>
    
</project>
View Code

 

 

 

1、/* 默认配置REQUEST
转发需要走过滤器,拦截器是前端控制器调用的
在web.xml中有

  <filter-mapping>
      <filter-name>struts2</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  action1向action2转发的时候过滤器不执行。

    因为在配置/*的时候默认配置是

 
 <dispatcher>REQUEST</dispatcher>

  客户端的请求才会走前端控制器,转发不走。

  转发需要走的时候,要配置一下。

  首先拦截器是前端控制器调用的,前端控制器不走拦截器就无效了。

  

<dispatcher>FORWARD</dispatcher>

  配置之后转发就会执行。

 但是不能只写一个,不然另外一个会失效,所以两个都要写。
  
  <!-- struts核心控制器 -->
  <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>
      <!--客户端请求 执行过滤器 doFilter调用拦截器栈-->
      <dispatcher>REQUEST</dispatcher>
      <!--服务器内部转发跳转执行doFilter-->
      <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  默认的Action

  

 2、EasyUI

新建一个html页面,导入。

  

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

jQuery文件

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

easyui文件

<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>

国际化文件

<link type="text/css" rel="stylesheet" href="../js/easyui/themes/default/easyui.css"/>
    <link type="text/css" rel="stylesheet" href="../js/easyui/themes/icon.css"/>

样式使用link导入进来。

<div id="cc" class="easyui-layout" style="width:600px;height:400px;"> 
<body>
    <div id="cc" class="easyui-layout" style="width:600px;height:400px;"> 

    <div data-options="region:'north',title:'North Title',split:true" style="height:100px;"></div> 

    <div data-options="region:'south',title:'South Title',split:true" style="height:100px;"></div> 

    <div data-options="region:'east',iconCls:'icon-reload',title:'East',split:true" style="width:100px;"></div> 

    <div data-options="region:'west',title:'West',split:true" style="width:100px;"></div> 

    <div data-options="region:'center',title:'center title'" style="padding:5px;background:#eee;"></div> 

</div>

 

布局必须使用class=“easyui-layout”.每个其他的div代表一个区域。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



posted @ 2018-03-21 18:43  张小铁  阅读(337)  评论(0编辑  收藏  举报