qq_34754950
feather092
2017-11-19 06:11

idea mvc映射不起作用

  • spring
  • intellij-idea
  • eclipse

web mvc项目,xml读取的到控制器,下面是mvc配置


web.xml配置


spring
/

控制器

@Controller
@RequestMapping(value = "/")
public class mainController {

@Autowired

private TestService testService;

@RequestMapping(value = "login", method = RequestMethod.GET)
public String login(
){
System.out.print("login\n");
//view/index.jsp
return "login";
}

tomcat app context 为默认的

运行结果

警告 [http-nio-8080-exec-1] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'spring'

一直找不到原因,原本的项目在eclipse里可以正常运行

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答