構建 SSH 架構

來源:互聯網
上載者:User

標籤:

http://www.cnblogs.com/younes/archive/2011/12/21/2295759.html

 

用MyEclipse搭建SSH架構 Struts Spring Hibernate

1、new一個web project。

2、右鍵項目,為項目添加Struts支援。

點擊Finish。src目錄下多了struts.xml設定檔。

3、使用MyEclipse DataBase Explorer建立資料來源。

 

 

---------------------  自己添加的 別人的文章-------------------------------

window->show view->other->輸入 “db” 找到,搞定

  本意是為了和手寫jdbc對照,不過不要和原來的手寫串連重名。

 

--------------------------------------------------- !!!!!!!!-----------------------------

new一個資料來源。填入資料來源資訊。

點擊test Driver,如果成功顯示:

點擊OK,點擊Finish。

4、為項目添加Spring支援。

選擇五個包,之後JAR Library Installation為如。

點擊Next。

預設點擊Finish。

5、為項目添加Hibernate支援。

預設的包,更改JAR Library Installation。

點擊Next。

選擇是建立Hibernate自己的設定檔,還是合并到Spring的設定檔。選擇合并,即更改點選框,點擊Next。

選擇Existing Spring Configration File,點擊Next。

選擇我們剛剛建立的資料來源。點擊Next。

去掉複選框的勾勾,點擊Finish。

6、發布項目,此時已經可以訪問這個項目的jsp頁面了。

7、後續工作。

在web.xml裡面加入spring配置與監聽如下。

<!-- Spring配置和監聽start -->
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/classes/application*.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!—end -->

8、結束。

構建 SSH 架構(轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.