SSM-based simple employee management system and ssm employee management system
I have learned about JAVA basics and have never done any interesting projects. In the recent summer vacation, I spent some time on it. So I learned about the recently popular SSM framework in practical enterprise applications, based on this, I learned how to write a website for adding, deleting, modifying, and querying MySQL based on SSM through online courses. I don't want to talk about it. The following describes the project.
First of all, the page UI is quickly built using the Bootstrap framework. This framework is still relatively easy to use, not only fast, but also beautiful, with a flat style. In addition, for my English dregs, there are help documents in Chinese, it is not very good to get started, and then set up roughly as shown in 1-1, of course, the building is just a static page, the following data, the button_click event of the button is self-written later.
Figure 1-1
Next we will introduce the specific process of SSM framework. Because it is accessed locally and not put on a networked server, Tomcat is used as the server and the project front-end initiates a request, sent to the SpringMVC front-end Controller, and then determined by the SpringMVC front-end Controller, whether it can be processed, can be processed, and then sent to the Controller. If it cannot process static pages, it is directly sent to the Tomcat server, let the server parse. The data sent to the Controller, and then the Service-layer business logic is called. If you want to interact with the database layer, you can hand it over to the components at the Dao layer. The components at the Dao layer are all written using MyBatis, And the Mapper of MyBatis then interacts with the database, at the same time, these Mapper files and interfaces are automatically generated through MyBatis Generator (MBG). However, because there are multiple tables for joint queries during the query, they are still in the xml file, two new methods are written to implement multi-table joint query. At the same time, the addition, deletion, modification, and query operations are basically implemented through Ajax. Ajax sends a request, returns Json, parses Json using JS, and displays it on the page.
Maven is used for dependency management. In short, Maven is used to download the jar package required by the project. After the project is complete, Maven can be used to build a war package, deploy the project on a real server rather than an image server in Eclipse.
After completing the general construction, let's take note of the practical use of the project. When adding new employees, we conducted front-end and back-end verification methods, it can greatly avoid adding dirty data and use regular expressions to determine whether the name and email address are valid. To transmit Ajax requests sent by the front end to the backend for processing, you only need to add @ ResponseBody and @ RequestMapping ("path suffix") to the method.
Finally, the implementation example is shown.
Implementation of the employee adding function:
Implementation of the modification function:
Single deletion implementation:
Batch delete:
This SSM-based basic employee management system has all the functions shown in. It allows for addition, deletion, modification, and query. Next, add the login page if it continues to improve, publish the project to the internet server, and there are too many drawbacks if there is no login page, so I will not discuss it. In addition, all the current test data has no practical significance, therefore, we do not consider publishing to the Internet.