annotation mapping config
Dear All,
Here is my controller annotation
@Controller
@RequestMapping("/manage_something.do")
@SessionAttributes("form")
public class ManageSomethingFormController {
…
}
Error Message: WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/MTS_TEST/manage_something.do] in DispatcherServlet with name 'dispatcher'.
It will work if I add the mapping in the servlet.xml
<property name="mappings">
<value> manage_something.do=manageSomethingFormController </value>
</property>
I thought the whole point of annotation controller is to get rid of the XML mapping including the url mapping completely.Could anyone help me figure out what I missed? Thank very much in advance.
Here are the config in dispatcher-servlet.xml and web.xml.
-------------------------------------------------------------
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="where/controller/are" />
------------------------------------------------------------------
web.xml
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<!-- Location of web application configuration for Spring -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/conf/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Route all URLs ending in .do to the dispatcher servlet -->
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.do</url-pattern> </servlet-mapping>