SpringMVC +Spring+ SpringJDBC整合实例。文件结构:

SpringMVC +Spring+ SpringJDBC整合实例。文件结构:

1)web.xml的配置:





   index.jsp




   org.springframework.web.util.IntrospectorCleanupListener



   spring
   org.springframework.web.servlet.DispatcherServlet
   
       contextConfigLocation
       classpath:*applicationContext.xml
   
   1


   spring
   *.do



   setcharacter
   org.springframework.web.filter.CharacterEncodingFilter
   
       encoding
       utf-8
   


   setcharacter


2)applicationContext.xml的配置:













   
       ${jdbc.driverClassName}
   
   
       ${jdbc.url}
   
   
       ${jdbc.username}
   
   
       ${jdbc.password}
   
   
   
       5
   
   
   
       30
   
   
   
       10
   
   
   
       60
   
   
   
       5
   
   
   
       0
   
   
   
       60
   
   
   
       30
   
   
   
       true
   
   
   
       false
   

   
       true
   




   







   
   


   
       
   













3)jdbc.properties的配置:

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/sssjdbc_test
jdbc.username=root
jdbc.password=123456

4)log4j.properties的配置:

root level

log4j.rootLogger=ERROR, stdout, A2
log4j.logger.gnnt=DEBUG
log4j.logger.org.springframework=WARN

console config

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{HH:mm:ss} [%c{1}] - %m%n

file config

log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A2.file=../logs/issue_mgr.log
log4j.appender.A2.DatePattern='.'yyyy-MM-dd
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=[%-5p] %d{HH:mm:ss} [%c{1}] - %m%n

你可能感兴趣的:(SpringMVC +Spring+ SpringJDBC整合实例。文件结构:)