1, based on Struts2,spring3,hibernate3
2, SSH corresponding to the struts spring hibernatestruts using MVC mode, mainly acting on user interaction
Spring uses the IOC and aop~ functions to be more abstract and loosely coupled for projects
Hibernate is the object persistence framework, actually is the entity class and the database table establishes the relation, the Operation class will trigger the corresponding SQL statement, may not write any SQL statement, completes the database compilation
Use steps
1, first build three frames respectively, first configure struts (1), add the following jar package to Lib Freemarker-2.3.15.jar
858.7 KB
Commons-io-1.3.2.jar
85.7 KB
Xwork-core-2.1.6.jar
1.5 MB
Ognl-2.7.3.jar
234.2 KB
Commons-fileupload-1.2.1.jar
56.4 KB
Ojdbc6.jar
1.9 MB
Struts2-core-2.1.8.1.jar
738.4 KB
(2), copy the existing struts.xml to SRC,
Struts.xml
bytes
(3), copy the existing Web. xml file, configure the Web. XML and STRUTS2 related configuration, configure the Interceptor
<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> </f Ilter-mapping> <listener> 2, configure hibernate
(1), copy jar package to Lib
"1" core Package a Hibernate3.jar
4.0 MB
"2" Ojdbc14.jar
1.5 MB
Javassist-3.12.0.ga.jar
618.5 KB
Antlr-2.7.6.jar
433.0 KB
Dom4j-1.6.1.jar
306.5 KB
Slf4j-api-1.6.1.jar
24.9 KB
Commons-collections-3.1.jar
546.3 KB
Jta-1.1.jar
10.6 KB
(2), copy the existing Hibernate.cfg.xml file to the SRC directory
Hibernate.cfg.xml
999 bytes
The contents are as follows <! DOCTYPE hibernate-configuration Public "-//hibernate/hibernate configuration DTD 3.0//en" "Http://www.hibernate. Org/dtd/hibernate-configuration-3.0.dtd ">
<!--1, load Database driver, get database connection-<session-factory> <property name= "Hibernate.dialect" >org. hibernate.dialect.oracle9idialect</property> <property name= "Hibernate.connection.driver_class" >orac le.jdbc.driver.oracledriver</property> <property name= "Hibernate.connection.username" >scott</prop erty> <property name= "Hibernate.connection.password" >tiger</property> <property name = "Hibernate.connection.url" >jdbc:oracle:thin: @localhost:1521:orcl</property><!--169.254.146.196-- >
<!--display SQL, defaults to false--<property name= "Hibernate.show_sql" >true</property>
<!--Adding a mapping file to the specific Java class--<mapping resource= "Com/ldl/bean/user.hbm.xml"/> <mappin G resource= "Com/ldl/bean/role.hbm.xml"/> </session-factory> 3. Configure spring (1), load jar package to Lib Commons-logging.jar
59.4 KB
org.springframework.aop-3.0.7 ...
313.9 KB
Aspectjrt.jar
112.2 KB
Cglib-nodep-2.1_3.jar
316.6 KB
org.springframework.jdbc-3.0 ....
377.0 KB
Org.springframework.context-3 ...
654.7 KB
org.springframework.core-3.0 ....
374.6 KB
Org.springframework.expressio ...
165.8 KB
Org.springframework.transacti ...
226.6 KB
Aspectjweaver.jar
1.5 MB
Aopalliance.jar
4.4 KB
org.springframework.asm-3.0.7 ...
51.8 KB
Org.springframework.aspects-3 ...
34.5 KB
(2), Configuration applicationcontext.xml and Applicationcontext.xml applicationcontext_jdbc.xml
1.5 KB
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.