简体   繁体   English

静态HTML页面的Spring View解析器

[英]Spring view resolver for static HTML pages

i have some of the run time generated html files which are placed in the 我有一些运行时生成的html文件,它们放置在

/WEB-INF/Static folder / WEB-INF /静态文件夹

in my context file i have added the below view resolver 在我的上下文文件中,我添加了以下视图解析器

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/static/"/>
    <property name="suffix" value=".html"/>
    <property name="order" value="0"></property>
</bean>

and other JSP are resolved by the tiles 和其他JSP由图块解决

But problem is when is give the name of the generated html file Dispatcher servlets gives Warning and view is not resolved 但是问题是什么时候给出生成的html文件的名称Dispatcher servlets给出警告并且视图无法解决

08:39:03,389  WARN PageNotFound:1110 - No mapping found for HTTP request with URI [/configserver/WEB-INF/static/page_1.html] in DispatcherServlet with name 'config'

i followed this post How to serve .html files with Spring 我按照这篇文章如何使用Spring服务.html文件

these are static content so added 这些是静态内容,所以添加了

<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />

and i return the name of the file from the controller method 我从控制器方法返回文件的名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM