吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:应用开发环境(3)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia Site Renderer 1.4 at 2014-06-15 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>mavenQs - Team list</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
    <meta name="Date-Revision-yyyymmdd" content="20140615" />
    <meta http-equiv="Content-Language" content="en" />
        
        </head>
  <body class="composite">
    <div >
                    <div >
                mavenQs
                </div>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div >
            
                    
                <div class="xleft">
        <span >Last Published: 2014-06-15</span>
                  &nbsp;| <span >Version: 1.0-SNAPSHOT</span>
                      </div>
            <div class="xright">                    <a href="./" title="mavenQs">mavenQs</a>
              
                    
      </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div >
      <div >
             
                    
                                          <h5>Project Documentation</h5>
                  <ul>
                                                                                                                                                                                                                                                                                                      <li class="expanded">
                          <a href="project-info.html" title="Project Information">Project Information</a>
                    <ul>
                      <li class="none">
                          <a href="index.html" title="About">About</a>
            </li>
                      <li class="none">
                          <a href="plugin-management.html" title="Plugin Management">Plugin Management</a>
            </li>
                      <li class="none">
                          <a href="distribution-management.html" title="Distribution Management">Distribution Management</a>
            </li>
                      <li class="none">
                          <a href="dependency-info.html" title="Dependency Information">Dependency Information</a>
            </li>
                      <li class="none">
                          <a href="source-repository.html" title="Source Repository">Source Repository</a>
            </li>
                      <li class="none">
                          <a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a>
            </li>
                      <li class="none">
                          <a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a>
            </li>
                      <li class="none">
                          <a href="integration.html" title="Continuous Integration">Continuous Integration</a>
            </li>
                      <li class="none">
                          <a href="plugins.html" title="Project Plugins">Project Plugins</a>
            </li>
                      <li class="none">
                          <a href="license.html" title="Project License">Project License</a>
            </li>
                      <li class="none">
            <strong>Project Team</strong>
          </li>
                      <li class="none">
                          <a href="project-summary.html" title="Project Summary">Project Summary</a>
            </li>
                      <li class="none">
                          <a href="dependencies.html" title="Dependencies">Dependencies</a>
            </li>
              </ul>
        </li>
          </ul>
                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
        <img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
      </a>
                   
                    
            </div>
    </div>
    <div >
      <div >
        <div class="section">
<h2>The Team<a name="The_Team"></a></h2><a name="The_Team"></a>
<p>A successful project requires many people to play many roles. Some members write code or documentation, while others are valuable as testers, submitting patches and suggestions.</p>
<p>The team is comprised of Members and Contributors. Members have direct access to the source of a project and actively evolve the code-base. Contributors improve the project through submission of patches and suggestions to the Members. The number of Contributors to the project is unbounded. Get involved today. All contributions to the project are greatly appreciated.</p>
<div class="section">
<h3>Members<a name="Members"></a></h3><a name="Members"></a>
<p>There are no developers working on this project.</p></div>
<div class="section">
<h3>Contributors<a name="Contributors"></a></h3><a name="Contributors"></a>
<p>There are no contributors listed for this project. Please check back again later.</p><script type="text/javascript">
function offsetDate(id, offset) {
    var now = new Date();
    var nowTime = now.getTime();
    var localOffset = now.getTimezoneOffset();
    var developerTime = nowTime + ( offset * 60 * 60 * 1000 )+ ( localOffset * 60 * 1000 );
    var developerDate = new Date(developerTime);

    document.getElementById(id).innerHTML = developerDate;
}

function init(){
}

window.onLoad = init();
</script></div></div>
      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div >
      <div class="xright">
              Copyright &#169;                   2014.
          All Rights Reserved.      
                    
                  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.fkjava</groupId>
    <artifactId>mavenQs</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>mavenQs</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
package org.fkjava.mavenqs;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
    }
}
package org.fkjava.mavenqs;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for simple App.
 */
public class AppTest 
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( AppTest.class );
    }

    /**
     * Rigourous Test :-)
     */
    public void testApp()
    {
        assertTrue( true );
    }
}
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.fkjava</groupId>
    <artifactId>mavenQs</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>mavenQs</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <!-- 下面3个元素定义了exec插件的坐标 -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.3.1</version>
                <executions>
                    <execution>
                    <!-- 指定绑定到compile阶段 -->
                    <phase>compile</phase>  <!-- ① -->
                    <!-- 指定运行exec插件的java目标 -->
                    <goals>
                        <goal>java</goal>  <!-- ② -->
                    </goals>
                    <!--- configuration元素用于为插件的目标配置参数 -->
                    <configuration>
                        <!-- 下面元素配置mainClass参数的值为:org.fkjava.mavenqs.App -->
                        <mainClass>org.fkjava.mavenqs.App</mainClass>
                    </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
</web-app>
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
#Generated by Maven
#Mon Jun 16 18:12:45 CST 2014
version=1.0-SNAPSHOT
groupId=org.crazyit
artifactId=struts2qs
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_05">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>webDemo</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>第一个页面</title>
</head>
<body>

</body>
</html>
drop database javaee;
create database javaee;
use javaee;

create table news_inf
(
 news_id int primary key auto_increment,
 news_title varchar(255)
);

insert into news_inf
values
(null , '疯狂Java联盟'),
(null , 'crazyit.org');
<Context docBase="G:/publish/codes/01/aa" debug="0" privileged="true">
    <!-- 其中name指定数据源在容器中的JNDI名
    driverClassName指定连接数据库的驱动
    url指定数据库服务的URL
    username指定连接数据库的用户名
    password指定连接数据库的密码
    maxActive指定数据源最大活动连接数
    maxIdle指定数据池中最大的空闲连接数
    maxWait指定数据池中最大等待获取连接的客户端
    -->
    <Resource name="jdbc/dstest" auth="Container"
        type="javax.sql.DataSource" 
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/javaee"
        username="root" password="32147" maxActive="5"
        maxIdle="2" maxWait="10000"/>
</Context>
<?xml version="1.0" encoding="GBK"?>
<!-- 定义生成文件的project根元素,默认的target为空 -->
<project name="antQs" basedir="." default="">
    <!-- 定义三个简单属性 -->
    <property name="src" value="src"/>
    <property name="classes" value="classes"/>
    <property name="dest" value="dest"/>
    <!-- 定义一组文件和目录集 -->
    <path >
        <pathelement path="${classes}"/>
    </path>
    <!-- 定义help target,用于输出该生成文件的帮助信息 -->
    <target name="help" description="打印帮助信息">
        <echo>help - 打印帮助信息</echo>
        <echo>compile - 编译Java源文件</echo>
        <echo>run - 运行程序</echo>
        <echo>build - 打包JAR包</echo>
        <echo>clean - 清除所有编译生成的文件</echo>
    </target>
    <!-- 定义compile target,用于编译Java源文件 -->
    <target name="compile" description="编译Java源文件">
        <!-- 先删除classes属性所代表的文件夹 -->
        <delete dir="${classes}"/>
        <!-- 创建classes属性所代表的文件夹 -->
        <mkdir dir="${classes}"/>
        <!-- 编译Java文件,编译后的class文件放到classes属性所代表的文件夹内 -->
        <javac destdir="${classes}" debug="true" includeantruntime="yes"
            deprecation="false" optimize="false" failonerror="true">
            <!-- 指定需要编译的Java文件所在的位置 -->
            <src path="${src}"/>
            <!-- 指定编译Java文件所需要第三方类库所在的位置 -->
            <classpath ref/>
        </javac>
    </target>
    <!-- 定义run target,用于运行Java源文件,
        运行该target之前会先运行compile target -->
    <target name="run" description="运行程序" depends="compile">
        <!-- 运行lee.HelloTest类,其中fork指定启动另一个JVM来执行java命令 -->
        <java classname="lee.HelloTest" fork="yes" failonerror="true">
            <classpath ref/>
            <!-- 运行Java程序时传入2个参数 -->
            <arg line="测试参数1 测试参数2"/>
        </java>
    </target>
    <!-- 定义build target,用于打包JAR文件,
        运行该target之前会先运行compile target -->
    <target name="build" description="打包JAR文件" depends="compile">
        <!-- 先删除dest属性所代表的文件夹 -->
        <delete dir="${dest}"/>
        <!-- 创建dest属性所代表的文件夹 -->
        <mkdir dir="${dest}"/>
        <!-- 指定将classes属性所代表的文件夹下的所有
            *.classes文件都打包到app.jar文件中 -->
        <jar destfile="${dest}/app.jar" basedir="${classes}"
            includes="**/*.class">
            <!-- 为JAR包的清单文件添加属性 -->
            <manifest>
                <attribute name="Main-Class" value="lee.HelloTest"/>
            </manifest>
        </jar>
    </target>
    <!-- 定义clean target,用于删除所有编译生成的文件 -->
    <target name="clean" description="清除所有编译生成的文件">
        <!-- 删除两个目录,目录下的文件也一并删除 -->
        <delete dir="${classes}"/>
        <delete dir="${dest}"/>
    </target>
</project>
package yeeku;
/**
 * Description:
 * <br/>网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> 
 * <br/>Copyright (C), 2001-2010, Yeeku.H.Lee
 * <br/>This program is protected by copyright laws.
 * <br/>Program Name:
 * <br/>Date:
 * @author  Yeeku.H.Lee kongyeeku@163.com
 * @version  1.0
 */
public class Hello
{
    public void info()
    {
        System.out.println("欢迎使用Ant");
    }
}
package lee;

import yeeku.*;
/**
 * Description:
 * <br/>网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> 
 * <br/>Copyright (C), 2001-2010, Yeeku.H.Lee
 * <br/>This program is protected by copyright laws.
 * <br/>Program Name:
 * <br/>Date:
 * @author  Yeeku.H.Lee kongyeeku@163.com
 * @version  1.0
 */
public class HelloTest
{
    public static void main(String[] args) 
    {
        new javax.swing.JFrame().setVisible(true);
        new Hello().info();
        System.out.println(args[0]);
        System.out.println(args[1]);

    }
}
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
</web-app>
<?xml version="1.0" encoding="gbk"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.crazyit</groupId>
    <artifactId>struts2qs</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>struts2qs</name>
    <url>http://www.crazyit.org</url>

    <!-- 定义该项目所使用License -->
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <!-- 声明该项目所属的组织 -->
    <organization>
        <name>CrazyIt</name>
        <url>http://www.crazyit.org</url>
    </organization>

    <!-- 声明项目开发者 -->
    <developers>
        <developer>
            <id>kongyeeku</id>
            <name>kongyeeku</name>
            <email>kongyeeku@gmai.com</email>
            <url>http://www.crazyit.or</url>
            <organization>CrazyIt</organization>
            <!-- 声明开发者的角色 -->
            <roles>
                <role>developer</role>
            </roles>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <!-- 声明对项目有贡献的人 -->
    <contributors>
        <contributor>
            <name>fkjava</name>
            <email>fkjava@hotmail.com</email>
            <url>http://www.fkjava.org</url>
            <organization>疯狂软件教育中心</organization>
            <roles>
                <role>developer</role>
            </roles>        
        </contributor>
    </contributors>

    <dependencies>
        <!-- 配置该项目依赖Struts 2 -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <!-- 此处指定依赖的Struts 2版本 -->
            <version>2.3.16.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>
    <build>
        <finalName>struts2qs</finalName>
    </build>
</project>