no handler method in class.....
这篇文章的来源于最近新学习的springmvc遇到的问题如上,其实本身感觉springmvc并不是很难,但是苦于学习方法不得劲,就只好看着帮助文档和别人写的小例子了。看完别人的小例子照着helloworld跑出来了,但是感觉不明所以,所以我就先放弃了使用注解,全过程使用最原始的XML配置
<!--多方法解析器-->
<bean id="parameterMethodNameResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="paramName" value="method"/> </bean> <!-- action代理类 --> <bean id="student" class="org.springframework.web.servlet.mvc.multiaction.MultiActionController"> <property name="methodNameResolver" ref="parameterMethodNameResolver"/> <property name="delegate" ref="studentController"/> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="stu.do">student</prop> </props> </property> </bean>错误原因是因为注入delegate的时候它会检查action里边的请求方法是不是含有(HttpServletRequest,HttpServletResponse)没有就会抛出异常