SpringFramework web.xml 配置例子

一、UTF-8的Request字符集设定

   < 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 >
  
  
< filter - mapping >
        
< filter - name > encodingFilter </ filter - name >
        
< url - pattern >* . do </ url - pattern >
  
</ filter - mapping >

二、加载SpringFramework配置文件
  < listener >
        
< listener - class > org.springframework.web.context.ContextLoaderListener </ listener - class >
  
</ listener >
  
  
< context - param >
        
< param - name > contextConfigLocation </ param - name >
        
< param - value >/ WEB - INF / conf / applicationContext * .xml </ param - value >
  
</ context - param >

三、配置文件的默认约定
加载/WEB-INF/conf下面所有以applicationContext打头的xml文件。常见的文件有:
applicationContext.xml     : 常量资料配置文件;
applicationContext-datasource.xml  :数据库资料配置文件
applicationContext-service.xml  :服务资料配置文件

你可能感兴趣的:(SpringFramework web.xml 配置例子)