Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc SpringMVC提供不带控制器的视图_Spring Mvc_View_Tiles - Fatal编程技术网

Spring mvc SpringMVC提供不带控制器的视图

Spring mvc SpringMVC提供不带控制器的视图,spring-mvc,view,tiles,Spring Mvc,View,Tiles,我在WEB-INF/templates文件夹中有一个jspx文件(例如test.jspx),我想通过javascript访问它 我没有返回该视图的控制器,在我的应用程序中,我使用TileViewResolver 在test.jspx中,我想使用spring标记库来访问消息包 如何配置spring以服务test.jspx 我正在使用: <mvc:view-controller path="/templates/test.html" view-name="test" /> <bea

我在WEB-INF/templates文件夹中有一个jspx文件(例如test.jspx),我想通过javascript访问它

我没有返回该视图的控制器,在我的应用程序中,我使用TileViewResolver

在test.jspx中,我想使用spring标记库来访问消息包

如何配置spring以服务test.jspx

我正在使用:

<mvc:view-controller path="/templates/test.html" view-name="test" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/views/templates/</value>
        </property>
        <property name="suffix">
            <value>.jspx</value>
        </property>
        <property name="order" value="1" />
    </bean>

/WEB-INF/视图/模板/
.jspx

它不工作。

我不知道没有任何控制器是否可行,但您可以使用Spring MVC已经提供的控制器:。只需提供jsp的名称作为viewName属性。

我创建了一个新的ViewResolver,order=2,现在它可以工作了。