自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

SSH 環(huán)境搭建完整教程

開發(fā) 后端
SSH環(huán)境搭建是本文要介紹的內(nèi)容,主要是在struts2.18+spring2.5+hibernate3環(huán)境下搭建,來看內(nèi)容詳解。

SSH 環(huán)境搭建:struts2.18+spring2.5+hibernate3

一、SSH 環(huán)境搭建開發(fā)環(huán)境

1、Fileànewàweb project;

2、配置好TomCat;

二、SSH 環(huán)境搭建的配置structs

1、引入structs的包:

  1. struts2-config-browser-plugin-2.1.8.1.jar  
  2. struts2-core-2.1.8.1.jar  
  3. struts2-dojo-plugin-2.1.8.1.jar  
  4. struts2-spring-plugin-2.1.8.1.jar(structs與spring整合添加的包) 

2.修改WEB-INF下的web.xml,增加struts2的配置。增加代碼如下:這些配置代碼對于struts2是不變的,直接復(fù)制到web.xml即可。

  1. <filter> 
  2.         <filter-name>struts2</filter-name> 
  3.         <filter-class>         org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter  
  4.         </filter-class> 
  5.     </filter> 
  6.     <filter-mapping> 
  7.         <filter-name>struts2</filter-name> 
  8.         <url-pattern>/*</url-pattern> 
  9. </filter-mapping> 

3.添加src下添加struct.xml文件(見圖1)

注意:<result name="success" ..../>這部分,若type="redirect"將容易丟失很多信息,

若要傳入上下文信息,盡量不用,或者用type = "dispatcher"

 

4.在src/test包下添加action文件(見圖2)

 

5.添加jsp文件(見圖3)

 

 

二.Hibernate配置

1.用hibernate逆向工程,生成實體類文件和操作數(shù)據(jù)庫的dao類文件;分別復(fù)制到 test.model下,和test.service下,(不用建hibernate.cfg.xml)如下圖:(見圖4)

 

2.在spring的配置文件applicationContext.xml中增加以下內(nèi)容:在spring bean中注冊數(shù)據(jù)庫連接的datasouce以及sessionfactory;指定hibernate生成的實體類映射文件的具體位置;(見圖5)

 

 

3.在test.config下添加文件 serviceContext.xml 用于將 所有的set函數(shù)注冊到spring bean 里;(見圖6)

 

4.(見圖7)

 

 

(見圖8)

 

 

小結(jié):

SSH 環(huán)境搭建完整教程的內(nèi)容介紹完了,希望通過本文SSH 環(huán)境搭建內(nèi)容的學(xué)習(xí)能對你有所幫助!

責(zé)任編輯:程站 來源: 博客園
相關(guān)推薦

2022-09-29 13:24:00

VS codeCC++

2014-08-05 16:30:12

CentOS6LAMP

2015-06-09 13:45:14

2011-07-08 16:02:24

iphone

2011-09-13 15:26:25

MTK環(huán)境搭建

2011-08-02 17:37:01

IPhone開發(fā) 環(huán)境搭建

2011-09-06 10:36:10

QT平臺

2009-12-30 18:02:32

Silverlight

2011-09-13 17:15:58

Eclipse And

2011-09-14 10:52:39

Android 2.2

2011-07-22 18:13:59

IOS IDE Xcode

2011-08-22 09:48:16

WindowsObjective-C

2010-09-25 09:31:27

EclipseAndroid

2012-05-15 14:00:51

WP7開發(fā)環(huán)境

2012-03-07 11:30:09

PhoneGapWindows Pho

2011-08-30 18:01:20

2013-12-04 13:30:45

Android游戲引擎libgdx教程

2011-12-22 14:36:36

PhoneGapWindows Pho環(huán)境搭建

2009-06-19 18:42:06

jBPMSSH

2013-10-30 22:41:23

Clouda環(huán)境
點贊
收藏

51CTO技術(shù)棧公眾號