default view resolution in spring -
i spring newbie , have question view resolution. changing webapp downloaded online , uses simple view resolver strategy:
<bean id="jspviewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="viewclass" value="org.springframework.web.servlet.view.jstlview" /> <property name="prefix" value="/web-inf/view/" /> <property name="suffix" value=".jsp" /> </bean>
and keep getting 404 errors view resolution , suspecting uses sort of rewriting / filtering mechanism. there log can view in tomcat / spring class can override in order understand file spring trying when resolving incoming request?
i understand operation of internalresourceviewresolver
strips file name extensions. if request not have extension? instance:
@requestmapping("/foo") protected modelmap render() { return new modelmap(); }
then view name resolved in case?
see link log4j integration
spring-mvc doesn't use file request handling, uses controllers , requestmapping map request controller , respective method if any.
the internalresourceviewresolver have written resolves “view name” returned controller class jsp page residing in /web-inf/view/ directory.
an example
@controller public class simplecontroller{ @requestmapping("/home") public string homemapper(model model) { return "home"; } }
here homemapper method called if try access "home" , returns home relative jsp rendered "home.jsp" should present in /web-inf/view/
for more information see spring mvc reference or tutorial.
Comments
Post a Comment