This is the internship process, mainly used to understand and learn the company framework of a measurement system, mainly using the SSM framework of MAVEN Java Web Project, is a more common information management system. In the system will always encounter tangled long but understand the bug is easy to solve, here write this bug summary, I hope you and just learn the children's shoes to save time costs. If there are some mistakes, please be enthusiastic to point out ~ 1, Ajax request in the background has been executed, but back to the foreground 404
Cause: It may be that the background ignores the annotation @responsebody, which is the function of returning values as requests. Without this annotation, the response to the request should be a page, which should be added if the page is not needed. (PS: This annotation cannot be added when returning an Modelandview object, because it returns information that contains the entire page)
Workaround: Add @responsebody 2 in the Controller method , the background cannot receive the file uploaded by the foreground,
Cause: Missing file Upload related package, or springmvc about Multipartresolver is not configured in the.
Solve:
<!--added-
<bean id= "Multipartresolver" class= in the SPRINGMVC configuration file Org.springframework.web.multipart.commons.CommonsMultipartResolver "></bean>
<!--add Dependency in Pom.xml-
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId> commons-fileupload</artifactid>
<version>1.3</version>
</dependency>
< dependency>
<groupId>commons-io</groupId>
<artifactid>commons-io</artifactid >
<version>2.4</version>
</dependency>
3, using Fileinput.js to get other plugins is a strange error (e error, what function Nothing)
Cause: First make sure that the correct path is called, it is possible to put jquery.js behind.
FIX: The correct order should be jquery in front. 4, access to HTML, page report 404 error, "The requested resource is not available"
Cause: This is because Dispatcherservlet will intercept static resources and cause static resources to be inaccessible.
Workaround: I typically include the following in the SPRINGMVC configuration file:
(PS: Want to know other methods can refer to article http://blog.csdn.net/wdehxiang/article/details/77619621) 5, Parameter ' email ' not found. Available parameters is [0, 1, param1, param2]
Here we need a simple look at the Mabatis parameter-passing mechanism. The parametertype that MyBatis can now use are basic data types and Java complex types.
Basic data type: Contains Int,string,date and so on. The base data type is passed as a parameter and can only pass in one. obtained by #{parameter name}.
Complex data types: Contains Java entity classes, maps. Obtained by #{property name} or #{map of KeyName}.
Cause: When multiple values are passed in, MyBatis automatically turns these values into a map-like value to 0,1,2 ... The sequence is keyname.
Resolution: scenario one, in the method of the DAO Layer Mapper interface, add @param annotations for each parameter
Public User Login (@Param (value= "email") string email, @Param (value= "password") string password);
<select id= "Login" resulttype= "User" parametertype= "String" >
select * from User where email=#{email} and Password=#{password}
</select>
Scenario Two: Storing multiple values in a map
Public User Login (hashmap<string,string) map);
The mapper.xml can be passed through #{keyname}.
<select id= "Login" resulttype= "User" parametertype= "Map" >
select * from User where email=#{email} and Password=#{password}
</select>
Scenario Three: obtained by #{0},#{1} in the order of passing parameters
Public User Login (string email, string password);
<select id= "Login" resulttype= "User" parametertype= "String" >
select * from User where email=#{0} and Password=#{1}
</select>