修改商户界面报405错误,按照视频来的,没有解决

来源:4-6 商户模块_商户接口开发

xy36

2018-02-02

http://img.mukewang.com/szimg/5a742acf00014a6e25600960.jpg

web.xml代码

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
  <display-name>大众点评</display-name>
  <welcome-file-list>
     <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>classpath:spring/root-context.xml</param-value>
  </context-param>

  <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>


  <filter>
     <filter-name>CharacterEncodingFilter</filter-name>
     <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
     <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
     </init-param>
  </filter>
  <filter-mapping>
     <filter-name>CharacterEncodingFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>



  <filter>
     <filter-name>MultipartFilter</filter-name>
     <filter-class>org.springframework.web.multipart.support.MultipartFilter</filter-class>
     <init-param>
        <param-name>multipartResolverBeanName</param-name>
        <param-value>multipartResolver</param-value>
     </init-param>
  </filter>
  <filter-mapping>
     <filter-name>MultipartFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter>
     <filter-name>hiddenHttpMethodFilter</filter-name>
     <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
  </filter>
  <filter-mapping>
     <filter-name>hiddenHttpMethodFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>




  <servlet>
     <servlet-name>spring</servlet-name>
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
     <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring/applicationContext.xml</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>spring</servlet-name>
  <url-pattern>/</url-pattern>
   </servlet-mapping>
 
  <jsp-config>
     <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <include-prelude>/WEB-INF/jsp/system/common.jsp</include-prelude>
     </jsp-property-group>
  </jsp-config>
</web-app>


root-context.xml代码

<?xml version="1.0" encoding="UTF-8"?>
<beans  
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">


  <!-- 配置文件上传解析器 -->
  <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
     <!-- 指定所上传文件的总大小不能超过20M。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
     <property name="maxUploadSize" value="20000000"/>
     <property name="defaultEncoding" value="utf-8"></property>
  </bean>

</beans>

写回答

3回答

源生活

2018-02-04

你可以先用我提供的完整版,部署在你的开发环境里,看下是不是出现同样的问题。

0
0

源生活

2018-02-04

换低版本tomcat试试,之前有同学问过,发现一些高版本会发生的问题,换成tomcat7试试

0
6
xy36
回复
源生活
就是自己添加了一些代码后就好了,已解决
2018-02-07
共6条回复

源生活

2018-02-03

hidden也加过了是吧?按视频里的方法跟踪一下源码呢?

0
1
xy36
加了hidden,按照视频追踪过源码,能获取attrName和id。还是报方法错误
2018-02-04
共1条回复

IT段子手详解MyBatis遇到Spring 秒学Java SSM开发大众点评

【毕设】SSM全面梳理,前后端分离,zTree 和复杂SQL打造权限系统,解惑MyBatis和RESTful

1001 学习 · 485 问题

查看课程