tomcat - Spring MVC 3 Web.xml welcome file (index.jsp) doesn't get displayed 404 -
hope can because far can see, set correctly (but please prove me wrong).
i have spring 3 mvc project configured follows:
web.xml
<servlet> <servlet-name>myservlet</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>/frontpage</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/myservlet-service.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener>
and myservlet-servlet.xml
<mvc:annotation-driven /> <context:component-scan base-package="my.path.to.controllers" /> <bean class="org.springframework.web.servlet.mvc.annotation.defaultannotationhandlermapping" /> <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/views/" /> <property name="suffix" value=".jsp" /> </bean>
i have index.jsp within web-inf (not web-inf/views) nothing more "hello" (i trying forward /frontpage).
now, if type in url controllers (localhost:8080/myservlet/frontpage), controller works , view displayed, when first start 404 instead of index.jsp page. i've tried adding leading slash index.jsp makes no difference.
i must have made schoolboy error somewhere, can't life of me see where. can point out me?
spring mvc 3.2 tomcat 6 running in sts 2.9.1 servlet 2.5
many thanks.
the web-inf
folder not accessible publicly. have put index.jsp
somewhere reachable, instance in web application root folder.
/mywebapp /web-inf/ /index.jsp
Comments
Post a Comment