静态HTML页面的Spring视图解析器 [英] Spring view resolver for static HTML pages

查看:458
本文介绍了静态HTML页面的Spring视图解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些运行时生成的html文件放在

i have some of the run time generated html files which are placed in the

/ WEB-INF / Static文件夹

/WEB-INF/Static folder

在我的上下文文件中我添加了以下视图解析器

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>

和其他JSP由磁贴解析

and other JSP are resolved by the tiles

但问题是什么时候给出生成的html文件的名称Dispatcher servlets给出警告并且视图未解析

But problem is when is give the name of the generated html file Dispatcher servlets gives Warning and view is not resolved

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'


推荐答案

我关注此帖如何使用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

这篇关于静态HTML页面的Spring视图解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆