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

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

黄舟
黄舟原創
2017-04-15 11:17:321587瀏覽

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