Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC configuration problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC configuration problem

    Hi I am trying to build a spring mvc web project.But just get 404 always.
    my web.xml:
    Code:
     <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>
       </welcome-file-list>
       <listener>
    	<listener-class>
    		org.springframework.web.context.ContextLoaderListener
    	</listener-class>
    	</listener>
    my action-servlet.xml:
    Code:
    <context:component-scan base-package="mypakage.Controller"/>  
          
        <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        	<property name="cacheSeconds" value="0" />
    	</bean>
    	
    	<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/jsp/"/>
      		<property name="suffix" value=".jsp"/>
    	</bean>
    jsp files are under /WEB-INF/jsp/
    In my controller
    Code:
    @RequestMapping(value="/index",method=RequestMethod.GET)
    Could anyone please point out what's wrong here? Or give me some suggestions!
    Thank you very much and have a good night!

  • #2
    Don't map *.jsp to the dispatcher servlet make it something else. Also you have mapped *.jsp to the dispatcher servlet and expect /index to be matched that is obviously never going to happen.

    Comment

    Working...
    X