spring mvc中的视图框架

springmvc与常用的模板引擎都有集成.

1.freemarker 


	
		
		
		
			
				10
				zh_CN
				yyyy-MM-dd HH:mm:ss
				yyyy-MM-dd
				#.##
			
		
	
	
		
		
		
		
		
		
	

2. velocity

2.1 xml配置


	
		
		  
             
               UTF-8  
               UTF-8  
             
        
	
	
		
		  
      	  
      	  
       	  
       	
	

2.2 pom依赖

此外,pom中也需要依赖下面两个jar:

		
			org.apache.velocity
			velocity
			1.7
		
		
		
			org.apache.velocity
			velocity-tools
			2.0
		

2.3 java及html

//java
public ModelAndView getArts(String fuzzyName) throws Exception {
	List gaoKaoScoreList=dao.getFuzzyQuery(fuzzyName);
	//loads the /WEB-INF/template/gaoKaoScore.vm
	return new ModelAndView("gaoKaoScore","gaoKaoScoreList",gaoKaoScoreList);
}
//velocity in html

	#foreach ($element in $gaoKaoScoreList)
		
			$element.no
			$element.name
			$element.idCard
			$element.gender
			$element.type
			$element.chinese
			$element.math
			$element.comprehensive
			$element.english
			$element.total
			$element.luoFenplusZhaoGuFen
			$element.ranking
		
	#end



你可能感兴趣的:(spring)