关于Spring MVC 路径映射的问题

macrotea-cn macrotea-cn 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
配置:


<context:component-scan base-package="com.mtea.mis.controller" />

<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
<property name="caseSensitive" value="true" />
</bean>

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/view/" p:suffix=".jsp" p:viewClass="org.springframework.web.servlet.view.JstlView" />


代码:

@Controller
public class UserTypeController {

@Resource
private UserTypeService userTypeService;

@RequestMapping
public List<UserType> list() {
return userTypeService.geAll();
}

@RequestMapping("/input/{id}")
public String input(@PathVariable("id") int id,Model model) {
model.addAttribute(userTypeService.getByAutoId(id));
return "userType/input";
}


测试:

1.http://localhost:10123/userType/list.do 没有问题

2.http://localhost:10123/userType/input/3.do 出错:
2011-9-22 20:37:11 org.springframework.web.servlet.DispatcherServlet noHandlerFound
警告: No mapping found for HTTP request with URI [/userType/input/3.do] in DispatcherServlet with name 'SpringMVC'


请问何故,请激扬文字! 盼君多复!
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
macrotea-cn
Web 开发 81,108 成员 341,721 内容