The new phase of Java development--run-through project

Source: Internet
Author: User
Tags maven central

September 25, 2017, enter the company.

After entering the company, an engineer took me. gave me a previous project, let me run through;

The project is backstage based on Spring 4 +mybatis+mvc. Database Select MySQL, foreground based on bootstrap,jquery,vue.js. Development style restful, server Tomcat and Maven managed project, The development tool is eclipse;

For those who do not have a project at the moment, can enter open source China to find the appropriate case for analysis;

Task 1

Create MAVEN projects and manage jar packages with Pom.xml

The Maven I use is the default Maven accessory for Eclipse.

Of course, you can re-download maven yourself and configure Maven

Maven Central Warehouse

http://search.maven.org

Maven Agent Warehouse settings (10.18 not required)

Http://www.cnblogs.com/jimmy-muyuan/p/5223538.html

The design method of pom.xml dependency injection at present stage

<properties>...<spring-framework.version>4.1.6.release</spring-framework.version></ Properties>...<dependencies>...<dependency>      <groupid>org.springframework</groupid >      <artifactId>spring-jdbc</artifactId>      <version>${spring-framework.version}</ Version></dependency>...</dependencies>
  <plugin>    <groupId>org.apache.maven.plugins</groupId>         <artifactId> maven-compiler-plugin</artifactid>         <version>3.1</version>         <configuration>              <source>1.8</source>              <target>1.8</target>          </configuration>  </ Plugin>

Once downloaded, the jar package is automatically stored in MAVEN dependencies

Task 2 reading Code Phase 1, clearing the Code directory structure

To interpret the directory structure from the client:

showtable.jsp, display tabular data, stored in views;

Most of the pages need some common navigation bar, header, footer, these pages Uniform resource tags stored in tags.

Of course, the page needs Css,js,img,font, these resources are stored in the assets directory;

The page is then communicated via JS and backstage, and the data must be passed through Dispatcherservlet. Configure Servelt in Web. xml;

JS sends the data to the controller, (Controller stored in the Java.web) controller must establish a page of the relevant model (model stored in Pojo.model), so that controller quickly get the data on the page;

The page model data needs to be converted to entity (entity,pojo.entity) objects, entity objects and database counterparts (Respository,java.respository) (Mybatis,config.mybatis), Processing data requires complex business logic (service)

The Entity object (pojo.entity) and the database sometimes do not correspond to one by one, you need to pass the conversion, so, there is domain;

(Note: This mode is not applicable for all Web development models)

Task 3. Read the code, ask questions, and think about how the code is written

Modify data for common operational databases

In this project, the front end uses jquery's DataTables to implement table rendering

Considerations for modifying data (URL address user/${uuid})

1. Prevent late, click on the lock screen, modify the end of the release

2. The effectiveness of the front-end data, improve the user experience, experimental jquery.validate, the front-end data validation (front-end verification does not guarantee the validity of data, customers through the client's debug mode, can still pass data to the background)

3. The validity of the background data, the page model class, add annotations to the field validation validity (data validation obtained by the controller layer) @valid (javax.validation.valid)

4. Judgment of the Business Logic Layer (service) (1. Whether there is a user 2. Data exclusive (has been modified) 3. Whether the database has been modified successfully [data layer, delete and change statement return value int])

This reading effect, or the global reading, does not go deep into the code to understand.

Finally, the data is modified by Ajax (URL address User/detial.json).

There is no ${uuid} on the address bar, the hidden UUID element is required in the page table

[The knowledge that is designed will be queried on the internet]

Task 4. In-depth thinking

The new phase of Java development--run-through project

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.