首頁 微信小程式 小程式開發 S2SH開發小程式的圖文程式碼分享

S2SH開發小程式的圖文程式碼分享

Apr 15, 2017 am 11:17 AM

1.       源碼準備:

1)  struts2 源碼:

a)       struts-2.1.6-all.Np##. #b)      xwork-2.1.6.rar

c) ​​     jp.gr.java_conf.ussiy.app.propedit_5.3.3.zip,

e

S2SH開發小程式的圖文程式碼分享

#' se 管理資源檔案

2)  spring2.5 原始碼:

a) spring-framework-2.5.6.zip

#3)  hibernate3.2 來源碼:

a)       hibernate-distribution-3.3.2.GA-dist.zipS2SH開發小程式的圖文程式碼分享

b)      hibernate-annotations-3.4.0.GA.zip#> .zip

2.       SSH 所需要的 jar 包:1)  jar 包圖解:

# :######3.       所需注意的問題:######1)  @Scope(value=”propotype”)  所需注意的問題:######1)  @Scope(value=”propotype”)  所需注意的問題:######1)  @Scope(value=”propotype”)  所需注意的問題:######1)  @Scope(value=”propotype”)  所需注意的問題:######1)  @Scope(value=”propotype”) 問題######a)      # # 類,需要定義其類型為: propotype ,在類別上方加上:@Scope(value=”propotype”)######b)      如果不設置, spring 初始化的每個類,則預設 Scope值為 方式。然而 webWork 的Action 不是執行緒###安全###的,要求在多執行緒環境下必須是一個執行緒對應一個獨立的實例,不能使用singleton 。所以,我們在 Spring 配置 webWork Action Bean 時,需要加上###屬性###scope=”prototype” 或 singleton=”false” 。 #####2)  Open###Session###InViewFilter 相關問題:######a)       由於 Hibernate 引入了 Lazy Load ##如果再想透過 getter/load 方法取到其關聯物件的值, Hibernate 會拋出一個 LazyLoad 的###Exception### 。 ######b)      解決這個問題, Spring 引入了這個 Filter ,而使 Hibernate 的 Session 的###生命週期###變長。 ######c) ​​     特定設定:###
<filter> 
    <filter-name>openSessionInView</filter-name> 
    <filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
    </filter-class>  
    <init-param> 
         <param-name>sessionFactoryBeanName</param-name> 
         <param-value>sf</param-value> 
    </init-param>
</filter> 
<filter-mapping> 
    <filter-name>openSessionInView</filter-name>      
    <url-pattern>/*</url-pattern> 
</filter-mapping>
登入後複製
###3)  中文###亂碼問題###:######a)       中文亂碼問題,並在「參考struts.#」 ## 中設定:###
<constant name="struts.i18n.encoding"  value="GB18030"  />
登入後複製
###仍然無法解決。 ######b)      此為 strtust2.1.6 的一個 bug 問題,且解決方法是使用 spring 提供 encodingFilter實現。 ######c) ​​     encodingFilter 具體設定:###
<filter>
	<filter-name>encodingFilter</filter-name>
	<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
	<init-param>
		<param-name>encoding</param-name>
		<param-value>GBK</param-value>
	</init-param>
</filter>
	
<filter-mapping>
	<filter-name>encodingFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping> 
登入後複製
###4) filter web.xml 中的順序問題:######a)   應該越配在前面。 ######b)   多個filter 在過濾過程圖解:######    如下:###############5)###上傳###檔案時###############5)###上傳###檔案時清除###快取###filter:###
<filter>
     <filter-name>struts-cleanup</filter-name>
     <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
    <filter-name>struts-cleanup</filter-name>
     <url-pattern>/*</url-pattern>
</filter-mapping>
登入後複製
###在做上傳檔案的時候,要在web.xml中增加ActionContextCleanUp這個filter,如果不增加,會發生第一次上傳取不到檔案的情況###

以上是S2SH開發小程式的圖文程式碼分享的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)