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 基于注释的视图映射_Spring Mvc_Spring Annotations - Fatal编程技术网

Spring mvc 基于注释的视图映射

Spring mvc 基于注释的视图映射,spring-mvc,spring-annotations,Spring Mvc,Spring Annotations,我正试图了解基于注释的映射,但将请求直接映射到jsp时遇到了一些问题 所有请求都必须通过控制器吗?是否可以让它只转到jsp而不为GET声明RequestMapping 我正在使用InternalResourceViewResolver。下面是我的app-servlet.xml <context:annotation-config/> <context:component-scan base-package="com.pioneer.b2broe.web" /> <

我正试图了解基于注释的映射,但将请求直接映射到jsp时遇到了一些问题

所有请求都必须通过控制器吗?是否可以让它只转到jsp而不为
GET
声明
RequestMapping

我正在使用
InternalResourceViewResolver
。下面是我的app-servlet.xml

<context:annotation-config/>

<context:component-scan base-package="com.pioneer.b2broe.web" />

<mvc:annotation-driven />

<mvc:view-controller path="/" view-name="home"/>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"   p:prefix="/WEB-INF/jsp/"
p:viewClass="org.springframework.web.servlet.view.JstlView" p:suffix=".jsp"  p:order="2"/>

您可以使用ParameterableViewController,它将请求重定向到“viewName”属性中的视图集


<bean name="/helloworld.htm" class="org.springframework.web.servlet.mvc.ParameterizableViewController">  
    <property name="viewName" value="helloworld"/>  
</bean>


我认为可以这样写:
我说得对吗?