This repository contains a simple web application for managing user data using Spring Boot, Spring Data JPA, and MySQL. Below is a guide on setting up and running the project.
- Java Development Kit (JDK) installed on your machine.
- MySQL database installed and running.
- Open the
application.properties
file located insrc/main/resources
. - Configure the MySQL database connection properties:
spring.datasource.url=jdbc:mysql://localhost:3306/YourDatabaseName spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.jdbc.Driver
- Create a MySQL database named
YourDatabaseName
(or the desired name). - The application is configured to automatically create/update tables using Hibernate. Run the application, and the necessary tables will be created.
- Clone this repository to your local machine.
- Open repository in your IDE and run the
WebPageCrudApplication.java
file on location/src/main/java/com/WebPage/WebPageCrud/WebPageCrudApplication.java
. - The application will be accessible at http://localhost:8080/showusers.
- Open a web browser and go to http://localhost:8080/showusers to access the home page.
- Click on "User List" in the navigation bar to view the list of users.
- To add a new user, click on "New" and fill in the required details.
- To edit or delete a user, click on "Edit" or "Delete" next to the respective user in the list.
- Controller: The
MainController
class handles web requests and interacts with theUserService
. - Service: The
UserService
class provides business logic and interacts with theUserRepository
. - Repository: The
UserRepository
interface extends the Spring DataCrudRepository
for database operations. - Model: The
UserModel
class represents the entity mapped to the database table.
- The frontend views are implemented using JSP (JavaServer Pages).
- CSS styles are applied for a clean and responsive user interface.
- The application uses Spring Boot for rapid development and Spring Data JPA for database access.
- Hibernate is used as the JPA provider for database operations.
Feel free to explore and modify the project according to your requirements. If you encounter any issues or have suggestions for improvements, please open an issue in the GitHub repository. Happy coding!