Spring3 MVC 集成Velocity中文支持
来源:互联网 发布:flash软件打不开 编辑:程序博客网 时间:2024/06/10 10:14
Maven中加上Velocity的依赖如下:
<!-- Velocity --><dependency><groupId>org.apache.velocity</groupId><artifactId>velocity</artifactId><version>1.5</version></dependency><dependency><groupId>velocity-tools</groupId><artifactId>velocity-tools-generic</artifactId><version>1.2</version></dependency>配置VelocityConfig
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> <property name="resourceLoaderPath"> <value>/</value> </property> <property name="velocityProperties"> <props> <prop key="input.encoding">utf-8</prop> <prop key="output.encoding">utf-8</prop> <prop key="contentType">text/html;charset=utf-8</prop> </props> </property> </bean>配置ViewReslover
<bean name="negotiationViewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <property name="order" value="1"></property> <property name="mediaTypes"> <map> <entry key="json" value="application/json" /> </map> </property> <property name="viewResolvers"><list> <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> <property name="order" value="2" /> <property name="prefix"><value>/velocity/</value></property> <property name="suffix"><value>.vm</value></property> <property name="exposeSpringMacroHelpers"><value>true</value></property> <property name="contentType"><value>text/html;charset=utf-8</value></property></bean></list></property><property name="defaultViews"><list><bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /></list></property></bean>在.vm的文件中加上如下的html header属性:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Content-Language" content="zh-CN" />特别要注意的是:
一定在IDE中确保你的文件保存格式为utf-8否则中文还是会出现乱码。
这博客写,自己都感觉太水!属于敷衍自己!
- Spring3 MVC 集成Velocity中文支持
- spring3集成velocity配置
- spring3 MVC+mybatis+velocity+maven
- Spring MVC 集成 Velocity
- Spring MVC 集成 Velocity
- Spring MVC 集成Velocity
- spring mvc 集成velocity模板
- spring mvc 集成velocity模板
- MyBatis教程之与Spring3集成和Spring3 Mvc集成
- velocity集成到spring mvc中
- Spring 国际化的支持:Spring MVC Velocity
- Spring3.1.2(MVC)与Hibernate4集成
- SSH支持Annotation集成 (Struts2 Spring3 Hibernate3)
- Springframwork中集成Velocity的中文解决方案
- Springframwork中集成Velocity的中文解决方案
- spring3 mvc @ResponseBody 中文乱码解决方案
- spring3 mvc rest返回中文乱码? 解决问题
- spring mvc支持多视图解析(jsp,velocity,freemarker)
- JavaSE第一百零三讲:wait及notify方法全名、深度剖析
- 启动 LocalDB 和连接到 LocalDB
- Buffalo WHR-G301N的Gargoyle(石像鬼)固件成功刷入WHR-G300N V2,正常使用中!
- 杀死某个名称的进程
- sql server错误代码大全
- Spring3 MVC 集成Velocity中文支持
- 用户注册后,通过网站发送到邮箱中的激活链接激活用户 java
- 快速排序,古老的算法
- Redhat EL5+mysql+django
- 系统资源,js、图片缓存,提高系统运行速度
- Seesion的几个认识
- Extjs常见的几种绘图实现
- 王爽《汇编语言》学习笔记--第二章
- Linux Socket Communication