SpringBoot 整合Freemarket 获得contextPath

SpringBoot 整合Freemarket 获得contextPath

如果使用SpringMVC整合Freemarket 在页面上获得这个,需要进行如下配置

  <property name="freemarkerVariables">  
        <map>   
            <entry key="contextPath" value="/Blog/"></entry>  
        </map>  
  </property>

那么使用springBoot整合了Freemarket怎么获得这个contextPath

同样的,我们可以在application.properties里面增加一个配置即可

spring.freemarker.request-context-attribute=request

spring.freemarker.request-context-attribute=request

在页面上,我们可以这样获得这个contextPath

${request.contextPath}

request.contextPath



爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img