SSH項目整合開發(fā)的環(huán)境搭建 spring jar下載地址 http://maven./release/org/springframework/spring/ 環(huán)境搭建是一個難點 通用包(7個): commons-dbcp2-2.1.jar commons-logging-1.1.3.jar commons-pool2-2.3.jar commons-collections4-4.0.jar aopalliance-1.0-20100517.210215-13.jar mysql-connector-java-5.1.33-bin.jar aspectjweaver-1.6.9.jar struts包(13+1) asm-3.3.jar asm-commons-3.3.jar asm-tree-3.3.jar commons-fileupload-1.3.1.jar commons-io-2.2.jar commons-lang3-3.2.jar freemarker-2.3.22.jar javassist-3.11.0.GA.jar log4j-api-2.2.jar log4j-core-2.2.jar ognl-3.0.6.jar struts2-core-2.3.24.jar xwork-core-2.3.24.jar struts2-spring-plugin-2.3.24.jar hibernate包(10個) antlr-2.7.7.jar dom4j-1.6.1.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar jandex-1.1.0.Final.jar javassist-3.18.1-GA.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction-api_1.2_spec-1.0.0.Final.jar spring包(10個) spring-beans-4.1.6.RELEASE.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-aop-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-orm-4.1.6.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-aspects-4.1.6.RELEASE.jar 整合包下載(包含Jar包和配置文件) http://pan.baidu.com/s/1bn54wd5 SSH環(huán)境配置 1.配置jar包 2.增加配置文件 (1) web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java./xml/ns/j2ee" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://java./xml/ns/j2ee http://java./xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Blank</display-name> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <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> </filter-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app> (2) struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts./dtds/struts-2.3.dtd"> <struts> <package name="all" namespace="/" extends="struts-default"> </package> </struts> (3) hibernate-cfg.xml <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www./dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/album</property> <property name="connection.username">root</property> ///這里面的密碼和用戶名等等以及數(shù)據(jù)庫都是和自己的數(shù)據(jù)庫有關(guān) <property name="connection.password">12345678</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <property name="show_sql">true</property> <!-- Drop and re-create the database schema on startup --> <property name="hbm2ddl.auto">update</property> <mapping class="net.xinqushi.model.User"/> </session-factory> </hibernate-configuration> (4)applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www./schema/beans" xmlns:xsi="http://www./2001/XMLSchema-instance" xsi:schemaLocation="http://www./schema/beans http://www./schema/beans/spring-beans.xsd"> </beans> struts.xml和 hibernate-cfg.xml放在src目錄下 applicationContext.xml和web.xml放在 WEB-INF目錄下 |
|
來自: 昵稱27831725 > 《框架SSH》