Spring 3 MVC - 查看没有控制器的JSP页面的解析器 [英] Spring 3 MVC - View Resolver for JSP pages with no controller

查看:154
本文介绍了Spring 3 MVC - 查看没有控制器的JSP页面的解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始弹簧3开发,之前我曾使用过弹簧2.5。
我被View Resolver困住了。我有以下配置

I just started the spring 3 development and I had use spring 2.5 previously. I got stuck with the View Resolver. I had the following configuration

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/jsp/"/>
    <property name="suffix" value=".jsp"/>
</bean> 

是的,如果jsp页面位于/ WEB-INF / jsp路径中,它会起作用。我遇到的问题是,如果我在里面有一个jsp(例如/WEB-INF/jsp/prod/Monitor/success.jsp),如果输入 http://localhost/Project/prod/Monitor/success.html 在浏览器中。

And yes it works if the jsp pages is in the /WEB-INF/jsp path. The problem that I stumble is that if I had a jsp inside (e.g. /WEB-INF/jsp/prod/Monitor/success.jsp), I cannot get it to resolve the page if I type http://localhost/Project/prod/Monitor/success.html in the browser.

我在这里错过了什么。只是为了获得更多信息,jsp将显示jsp是否有控制器,但是我需要它来解析没有控制器关联的jsp页面。

Did i miss anything here. Just for more info, the jsp will show up if the jsp had a controller, but I need it to resolve jsp pages with no controller associate with it.

推荐答案

将此添加到上下文中:

<mvc:view-controller path="/prod/Monitor/success.html" view-name="/prod/Monitor/success" />

这篇关于Spring 3 MVC - 查看没有控制器的JSP页面的解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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