Sharing of graphic and text code for S2SH development applet

黄舟
Release: 2017-04-15 11:17:32
Original
1667 people have browsed it

1. Source code preparation:

1) struts2 source code:

a) struts-2.1.6-all.zip

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:

Sharing of graphic and text code for S2SH development applet

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

Session

InViewFilter 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 LazyLoad

Exception. b) To solve this problem, Spring introduced this Filter, which makes the life cycle

of Hibernate's Session longer.

c) Specific configuration:

<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>
Copy after login

3) Chinese

garbled code problem

:

a) Chinese garbled code problem, in struts.xml

Medium configuration:

<constant name="struts.i18n.encoding"  value="GB18030"  />
Copy after login
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> 
Copy after login

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 Sharing of graphic and text code for S2SH development applet file Clear

cache

filter:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template