Record the problems with the SSM (spring+spring mvc+mybatis) framework for the two days

Source: Internet
Author: User

The query all return type needs to be a collection (list<>) or a class, because the query returns more than one data


List<> the add behind the collection. () Place the object, today innocently put in list = = Of course the error


The mapping of entities in MyBatis writes basic additions and deletions to the check operation. Note: When you need to query all you also need to write yourself in the map


Controller is written in the argument and returns the page


When using MyBatis, Mapper.java and Mapper.xml (his mapping), the ID of the SQL in the map must be the same as the name of the corresponding interface in Java. otherwise, it cannot be manipulated.


Note @requestmapping is a note used to process request address mappings, which can be used on classes or methods. Used on a class, the method that represents all the response requests in the class is the address as the parent path.


@RequestMapping has six properties

①value: Specifies the actual address of the request, and the specified address can be the URI Template mode (described later);

②method: Specifies the method type of the request, get, POST, put, delete, etc.

③consumes: Specifies the submitted content type (CONTENT-TYPE) of the processing request, such as Application/json, text/html;

④produces: Specifies the type of content returned, which is returned only if the specified type is included in the (Accept) type in the request header;

⑤params: Specifies that the request must contain certain parameter values to be processed by the method.

⑥headers: Specifies that some specified header value must be included in the request in order for the method to process the request.


And generatorconfig.xml This file this is the MyBatis of this framework generation (baby also do not know what good = =) mapping file of a gray often important thing

Use it to set up a directory of generated files (that is, the DAO interface that needs to be generated, the SQL entity, and the mapping that corresponds to them), and of course it can only generate a simple, slightly more complex mapper or it needs to be tapped by its own claws.


Today just opened my cabin, welcome you a lot of guests (na pastry is not [hum are my only reluctant to eat for you]), tea water pipe full O (∩_∩) o


For their own understanding, if there is a mistake please correct me (don't scold AH), small rookie began weaning. AW whining

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.