Spring mvc 基于注释的视图映射
我正试图了解基于注释的映射,但将请求直接映射到jsp时遇到了一些问题 所有请求都必须通过控制器吗?是否可以让它只转到jsp而不为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" /> <
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>
我认为可以这样写:
我说得对吗?