This is a Java web project which imitates the famous Chinese online shopping website Tmall. It supports all the major functions of any shopping websites, such as user register, login, logout, list products by category, search by key word, check product in detail and it also implements the entire process of shopping, like add to cart, checkout, generate orders, keep track of orders, review products so on and so forth.
Just like building many other Java projects, before running it, you need to install Java and a suitable IDE on our PC.
Firstly, you need to install Java JDK, JRE and set some environmental variables on your operating system. Here are some Java install instructions.
The next step is to select an IDE, I recommend you to use Eclipse or IntelliJ IDEA. Here are the links of their download page.
After copying the project on your local machine, you need to add it into your IDE as a project.
The process is simple. Take IntelliJ IDEA as an example, click File->Open File or Project, select the "pom.xml" file under the main folder, which allows the IDE to open the project with Maven.
To run the project, you need to install Maven at first:
Next in the Run/Debug configuration page, you must add a maven builder.
As for the maven builder, you should set the setting file and repository as the folder where you install the maven, like:
mavenFolder\.m2\settings.xml
mavenFolder\.m2\repository
You should use tomcat as server and set it listening to the 8080 port as default. To start the server, you can set the command line parameter as:
tomcat7:run
Once you start the server, you can visit the home page by typing the URL below on your browser:
http://localhost:8080/tmall_ssm/home
This system is quite complex, so I separate the code into several folders and put the backend and frontend codes into two separate directories.
The backend is implemented with Java and all the codes are under the org.pzy.tmall source directory. According to their function and responsibility, they are distributed into 6 sub-directories.
- controller : all the Spring MVC controllers, which directly handle the HTTP request.
- interceptor: check user login status, being called before requests are handled by controller.
- mapper: a series of interfaces, used to execute SQL command defined in .xml files to CRUD data.
- pojo: all the data types, which are in accord with the data defined in database.
- service: define several APIs called by controller, handle business logic by using the method in mapper.
- util: several utilities to process special kinds of data like uploaded images.
All the frontend codes are written in .jsp files with Java, Vue.js, HTML, Bootstrap and jQuery. They are distributed in three main folders;
- admin: all the codes of data management pages, which are only accessible for administrators.
- fore: the pages visible for all normal customers.
- include: some pages that are integrated into the pages in previous folders, and some shared pages like head and foot.
- Spring, MyBatis, Spring MVC- The back-end web framework used
- Vue.js, jQuery, Bootstrap- The front-end web framework used
- Maven - Dependency Management
Version-1.0
- Zeyu Pan Initial work - Github
This project is licensed under the MIT License.