一、JDK
  下载安装JDK1.6+
  设置环境变量JAVA_HOME=C:\Program Files\Java\jdk1.6.0_06
              CLASSPATH=C:\Program Files\Java\jdk1.6.0_06\lib;C:\Program Files\Java\jdk1.6.0_06\jre\lib;
二、Tomcat
  下载安装Tomcat6+
  设置环境变量CATALINA_HOME=D:\tomcat

三、Eclipse
  下载安装Eclipse3.4+
  设置Tomcat服务器 Window->Preferences->Tomcat
        Tomcat version = Version 6.x
        Tomcat home = D:\tomcat
        Context declaration mode = Server.xml
        Configuration file = D:\tomcat\confg\server.xml
        (如果系统装有MyEclipse,注意修改JVM Setting中JRE = jdk1.6+)

四、Project
  创建Web Dynamic Project
  设置Build Path = {Project}/WebContent/WEB-INF/classes

五、Spring
  下载Spring2.5.6
  1、Library
     将以下类包拷贝至WEB-INF/lib
        核心包:spring.jar
        依赖包:commons-*、cglib、dom4j、javassist、slf4j、aopalliance
  2、applicationContext.xml
     在WEB-INF下创建applicationContext.xml文件,内容如下:
     <?xml version="1.0" encoding="UTF-8"?>
     <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:aop="http://www.springframework.org/schema/aop"
                xmlns:tx="http://www.springframework.org/schema/tx"
                xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
     </beans>
  3、Web.xml
     修改Web.xml,增加如下内容:
     <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>/WEB-INF/applicationContext.xml</param-value>
     </context-param>
     <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>

六、Hibernate
  下载Hibernate3.1,以下主要整合spring框架进行配置。
   1、Library
     将以下类包拷贝至WEB-INF/lib
        核心包:hibernate3.jar
        依赖包:commons-*、dom4j、ojdbc14.jar(Oracle数据库驱动,其他数据库另选)
   2.Datasource、Connection和JNDI
     在META-INF/目录下创建context.xml,配置数据库连接池参数,内容如下:   
     <?xml version="1.0" encoding="UTF-8"?>
     <Context reloadable="true" crossContext="true">
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <Resource name="ojdbc/oracle"
                  auth="Container"
          type="javax.sql.DataSource"
                  driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@192.168.0.211:1521:orcl"
                  username="demo"
          password="1234"
          maxActive="10"
                  maxIdle="100"
                  maxWait="1000">
        </Resource>
      </Context>   
     修改Web.xml,增加以下内容:
        <resource-ref>
                <description>DB Connection</description>
                <res-ref-name>ojdbc/oracle</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
   3、applicationContext.xml
     修改applicationContext.xml,增加如下内容:
     <!-- 本地连接池配置 -->
     <bean >
                <!-- Add your actions here -->
          </package>
     </struts>
   3、web.xml
     修改Web.xml,增加如下内容:
     <filter>
          <filter-name>struts2</filter-name>
          <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
     </filter>
     <filter-mapping>
          <filter-name>struts2</filter-name>
          <url-pattern>/*</url-pattern>
     </filter-mapping>

相关文章:

  • 2021-05-28
  • 2021-10-24
  • 2021-06-05
  • 2021-08-12
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2021-12-26
  • 2022-02-21
  • 2022-12-23
  • 2021-09-14
相关资源
相似解决方案