Home >WeChat Applet >Mini Program Development >Sharing of graphic and text code for S2SH development applet
1. Source code preparation:
1) struts2 source code:
b) xwork-2.1.6.rar
c) jp.gr.java_conf.ussiy.app.propedit_5.3.3.zip,eclip se management resource file
2) spring2.5 source code:
a) spring-framework-2.5.6.zip
3) hibernate3.2 source code:
a) hibernate-distribution-3.3.2.GA-dist.zip
b) hibernate-annotations-3.4.0.GA.zip
c) slf4j-1.5.8 .zip
2. The jar package required for SSH:
1) Jar package illustration:
2) Jar package related instructions :
3. Issues that need attention:
1) @Scope(value=”propotype”) Question
a) Each defined action Class, you need to define its type as: prototype, add on the class: @Scope(value="propotype")
b) If not set, for each class initialized by spring, the default Scope value is singleton Way. However, webWork's Action is not thread-safe. It requires that one thread corresponds to an independent instance in a multi-threaded environment, and singleton cannot be used. Therefore, when we configure the webWork Action Bean in Spring, we need to add the attributescope=”prototype” or singleton=”false”. 2) Open
SessionInViewFilter related issues: a) Since Hibernate introduced the Lazy Load feature (), it makes the
object# out of Hibernate's Session cycle ##If you want to get the value of its associated object through the getter/load method, Hibernate will throw a LazyLoadException. b) To solve this problem, Spring introduced this Filter, which makes the life cycle
of Hibernate's Session longer.<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) Chinese
garbled code problem
:a) Chinese garbled code problem, in struts.xml
Medium configuration:<constant name="struts.i18n.encoding" value="GB18030" />still cannot be solved. b) This is a bug problem of strtust2.1.6. The solution is to use spring to provide encodingFilter implementation. c) The specific configuration of 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) The order of filters in web.xml: a) The filter with greater functionality in web.xml configuration The more worthy ones should be in the front. b) Diagram of the filtering process of multiple filters: As follows: ##5)
When uploading the file Clear
cachefilter:<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>
When uploading files, add the ActionContextCleanUp filter in web.xml. If it is not added, the file will not be retrieved for the first upload. Condition
The above is the detailed content of Sharing of graphic and text code for S2SH development applet. For more information, please follow other related articles on the PHP Chinese website!