springmvc中设置多个视图解析器

2020-12-13 02:51

阅读:276

标签:ber   prope   oca   time   port   cal   多个   vue   设置   

最近一直用的是Springboot +vue 前后端分离的 架构 ,所以对于Springmvc的各种配置有些生疏,看了下多个视图解析器的东西,觉得挺好的,所以想记下来

  1. freemark 和jsp的视图解析器的配置

 1 
 2     bean id="viewResolverCommon"
 3         class="org.springframework.web.servlet.view.InternalResourceViewResolver">
 4         property name="prefix" value="/WEB-INF/views/" />
 5         property name="suffix" value=".jsp" />
 6 
 7         property name="viewClass">
 8             value>org.springframework.web.servlet.view.InternalResourceView
 9             value>
10         property>
11         property name="order" value="1" />
12     bean>
13 
14     
15     
16     bean id="viewResolverFtl"
17         class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
18         property name="viewClass" value="com.sojson.core.freemarker.extend.FreeMarkerViewExtend" />
19         
20         property name="contentType" value="text/html; charset=utf-8" />
21         property name="cache" value="true" />
22         property name="suffix" value=".ftl" />
23         property name="order" value="0" />
24     bean>
25     bean id="viewResolver"
26         class="org.springframework.web.servlet.view.InternalResourceViewResolver">
27         property name="order" value="2">property>
28         property name="viewClass"
29             value="org.springframework.web.servlet.view.JstlView" />
30         property name="prefix" value="/WEB-INF/views/" />
31         property name="suffix" value=".jsp">property>
32     bean>
33 
34 
35 
36     
37     bean id="freemarkerConfig"
38         class="com.sojson.core.freemarker.extend.FreeMarkerConfigExtend">
39         property name="templateLoaderPath">
40             value>/WEB-INF/ftl/value>
41         property>
42         property name="freemarkerVariables">
43             map>
44                 entry key="xml_escape" value-ref="fmXmlEscape" />
45                 entry key="api" value-ref="api"/>
46             map>
47         property>
48         property name="defaultEncoding">
49             value>utf-8value>
50         property>
51         property name="freemarkerSettings">
52             props>
53                     prop key="template_update_delay">0prop>
54                     prop key="defaultEncoding">UTF-8prop>
55                     prop key="url_escaping_charset">UTF-8prop>
56                     prop key="locale">zh_CNprop>
57                     prop key="boolean_format">true,falseprop>
58                     prop key="datetime_format">yyyy-MM-dd HH:mm:ssprop>
59                     prop key="date_format">yyyy-MM-ddprop>
60                     prop key="time_format">HH:mm:ssprop>
61     
62                 prop key="number_format">#prop>
63                 prop key="whitespace_stripping">trueprop>
64                 prop key="auto_import">
65                     
66                     /common/config/top.ftl as _top,
67                     /common/config/left.ftl as _left
68                 prop>
69             props>
70         property>
71     bean>
72     bean id="fmXmlEscape" class="freemarker.template.utility.XmlEscape"/>
73     

 

springmvc中设置多个视图解析器

标签:ber   prope   oca   time   port   cal   多个   vue   设置   

原文地址:https://www.cnblogs.com/walkingcamel/p/11057777.html


评论


亲,登录后才可以留言!