About spring mvc configuration -
i trying build web app using spring mvc. far, when start server, 404. please give me suggestion configuration.
web.xml:
<servlet> <servlet-name>action</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file>
action-servlet.xml:
<bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="viewclass"><value>org.springframework.web.servlet.view.jstlview</value></property> <property name="prefix"><value>/web-inf/jsp/</value></property> <property name="suffix"><value>.jsp</value></property> </bean> <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter"/>
these under web-inf.
i have annotation:
@requestmapping(value="index.jsp",method=requestmethod.get)
mapping @ controller's method. jsp pages under webapp/web-inf/jsp/. 2 config files under web-inf
please give me suggestion!!! thank much!
in spring mvc, have return modelandview in method @requestmapping anotation this:
@requestmapping(value="/home") public modelandview gohome() { modelandview mav = new modelandview("home"); return mav; }
the string in modelandview depending on configuration in web.xml. in situation home.jsp page.
Comments
Post a Comment