zoukankan      html  css  js  c++  java
  • Spring MVC 使用问题与解决--HTTP Status 500

    1.HTTP Status 500 - Servlet.init() for servlet springmvc threw exception


    解决
    使用jre1.7 Spring4.3

    2.springMVC无法访问JSP报404,但是又能访问controller

    第一种原因:

    mvc
    org.springframework.web.servlet.DispatcherServlet

    contextConfigLocation
    classpath*:/mvc.xml

    1

     <servlet-mapping>
         <servlet-name>mvc</servlet-name>
         <url-pattern>/*</url-pattern>
     </servlet-mapping>
    

    将url-pattern中/*改为/
    配置对所有请求进行了拦截,controller对视图进行分发的时候又拦截。

    第二种原因:

    当时把jsp文件放到WEB-INF中了,但tomcat默认访问网页的目录是WEB-INF的父目录,正确的目录应该类似以下:

    3.

    a.No mapping found for HTTP request with URI [/sam_170309Web/user/register.action] in DispatcherServlet with name 'DispatcherServlet'
    b.No Spring WebApplicationInitializer types detected on classpath

    解决

    检查控制器中的@Controller以及mvcContext.xml中的Action注册:<context:component-scan base-package="pers.ryan.***"/>

    随心所欲不逾矩.
  • 相关阅读:
    POJ -- 3468
    HDOJ--1698
    简单的API应用
    Linux引导流程
    Python 实现网络爬虫小程序
    codeforce
    Count the string -- HDOJ 3336
    初次运行 Git 前的配置
    leetcode244- Shortest Word Distance II- medium
    leetcode243- Shortest Word Distance- easy
  • 原文地址:https://www.cnblogs.com/Ryan-Leo/p/6525074.html
Copyright © 2011-2022 走看看