简体   繁体   English

Spring 3 MVC - 查看没有控制器的JSP页面的解析器

[英]Spring 3 MVC - View Resolver for JSP pages with no controller

I just started the spring 3 development and I had use spring 2.5 previously. 我刚刚开始进行弹簧3开发,之前我曾使用过弹簧2.5。 I got stuck with the View Resolver. 我遇到了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> 

And yes it works if the jsp pages is in the /WEB-INF/jsp path. 是的,如果jsp页面在/ WEB-INF / jsp路径中,它可以工作。 The problem that I stumble is that if I had a jsp inside (eg /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(例如/WEB-INF/jsp/prod/Monitor/success.jsp),如果输入http:// localhost / Project /我就无法解析它浏览器中的prod / Monitor / success.html

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. 只是为了获得更多信息,jsp将显示jsp是否有控制器,但我需要它来解析没有控制器关联的jsp页面。

将此添加到上下文中:

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

You can treat these pages as static resources . 您可以将这些页面视为静态资源。 see this for details. 看到这个细节。

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

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