Remember a summary of errors in the development of a takeaway ordering applet

Problems encountered
1. JSP page garbled
Insert picture description here
Solution: add code to the head

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

2. js and other static resources cannot be accessed

Added in web.xml settings

  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <!-- 处理所有URL-->
    <url-pattern>/</url-pattern>
  </servlet-mapping>

It will affect the access of static resource files,
so it must be configured in SpringMVC.xml =

 <!-- 配置静态资料映射 -->
    <mvc:resources location="/WEB-INF/css/" mapping="/css/**"></mvc:resources>
    <mvc:resources location="/WEB-INF/js/" mapping="/js/**"></mvc:resources>

Here is the static resource placed in the WEB-INF directory
3. Execution error

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ssm.dao.LoginAndRegisterMapper.register
  at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:227)
  at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:49)
  at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:65)
  at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
  at com.sun.proxy.$Proxy19.register(Unknown Source)
  at com.ssm.service.LAndRService.register(LAndRService.java:13)
  at

This problem has bothered me for a day, and there are problems no matter how to
correct it. The next day I asked the teacher and I was satisfied to solve it.

First of all, the root cause is that in the location of the mapper.xml file, create a new directory that is the same as the dao layer interface file under resources.
Insert picture description here
Secondly, after I created the Mapper.xml file, I found that the file did not have an .xml suffix.
Calm, careful and careful

To be continued

Guess you like

Origin blog.csdn.net/wlj1442/article/details/108810125