Springside The default database is Hsql, but the database that most developers are familiar with is MySQL, so the first thing you encounter in the actual development process is to modify the database. It is easy to modify the database in Springside, or as an example of a Xkland project created in the previous article, first modify the Jdbc.properties file under the Src\main\resources\config folder, comment out 1, 2 lines, and annotate 7, 8 lines, and modify the username and password for lines 10 and 11 as follows:
1#jdbc.driverClassName=org.hsqldb.jdbcDriver
2#jdbc.url=jdbc:hsqldb:res:/hsqldb/helloworld
3
4#jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
5#jdbc.url=jdbc:oracle:thin:@localhost:helloworld
6
7jdbc.driverClassName=com.mysql.jdbc.Driver
8jdbc.url=jdbc:mysql://localhost:3306/xkland? useUnicode=true&characterEncoding=utf8
9
10jdbc.username=xkland
11jdbc.password=xkland
The second is to modify the Hibernate.properties file under the Src\main\resources\config folder, comment out the first line, and annotate the second line, as follows:
1#hibernate.dialect=org.hibernate.dialect.HSQLDialect
2hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
3#hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
4hibernate.show_sql=false
5hibernate.cache.use_query_cache=true
6hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
The process is simple, but there is one important thing to note, and that is to remember to copy the JDBC-driven mysql.jar provided by MySQL to the Src\main\webapp\web-inf\lib folder, otherwise you will encounter the following error:
Springside is very focused on support for i18n, so it's convenient to create an internationalized application, just add the appropriate resource file to the src\mian\resources\i18n folder. Springside default use of UTF-8 encoding, which is registered from the Web.xml Encodingfilter can be seen, of course, can also choose their favorite character encoding, such as GB2312. If you want to modify the character encoding, be sure to remember that there are four places to keep in line:
1, Web.xml in the Encodingfilter configuration, as follows:
<filter>
<filter-name>encodingFilter</filter-name>
<filter- class>org.springframework.web.filter.CharacterEncodingFilter</filter- class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>