@RequestMapping未正确映射

我正在尝试设置控制器,但遗憾的是无法查看输出…所有内容都正确呈现。 当我转到http://localhost:8080/CMT/content/edit我得到一个404页面。 从Netbeans运行我的应用程序转到http://localhost:8080/CMT

 package com.cmt.controllers; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller public class Content { @RequestMapping(value="/content/edit", method=RequestMethod.GET) public ModelAndView edit(Model model) { ModelAndView mv = new ModelAndView(); mv.setViewName("index"); return mv; } } 

APP-config.xml中

             

web.xml中

    contextConfigLocation /WEB-INF/applicationContext.xml   org.springframework.web.context.ContextLoaderListener   Spring MVC Dispatcher Servlet org.springframework.web.servlet.DispatcherServlet  contextConfigLocation /WEB-INF/app-config.xml  1   Spring MVC Dispatcher Servlet /*   index.jsp   

我该如何调试它,看看哪些有效,哪些无效?

更新

GlassFish服务器登录Netbeans显示

 INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1531ed: defining beans [content,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@b91162 INFO: Mapped URL path [/content/edit] onto handler [com.cmt.controllers.Content@1f3e27b] INFO: Mapped URL path [/content/edit.*] onto handler [com.cmt.controllers.Content@1f3e27b] INFO: Mapped URL path [/content/edit/] onto handler [com.cmt.controllers.Content@1f3e27b] INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. INFO: FrameworkServlet 'Spring-MVC-Dispatcher-Servlet': initialization completed in 1234 ms INFO: WEB0671: Loading application [CMT] at [/CMT] INFO: CMT was successfully deployed in 3,725 milliseconds. 

您的DispatcherServlet名为app映射到web.xml /* ? 从您之前的问题我看到:

  Spring MVC Dispatcher Servlet org.springframework.web.servlet.DispatcherServlet  contextConfigLocation /WEB-INF/app-config.xml  1   Spring MVC Dispatcher Servlet *.htm  

/content/edit URL与*.htm模式不匹配。 尝试/content/edit.htm以获得可能的解决方法。