Author

Author- Ram Ranjeet Kumar
Showing posts with label Springboot. Show all posts
Showing posts with label Springboot. Show all posts

Saturday, February 25, 2023

Sorting With Spring Boot, Thyemeleaf, Spring Data JPA, Hibernate, HTML and MySQL

 




In the previous post, we developed a Spring Boot Web Application(User Management System) with Thyemeleaf, HTML, Spring Data JPA, Maven and MySql Database. Also Implement the Pagination In the Application

Here in this  we are going to implement sorting concept in this Web Application.

What is in this article ?

  • We sort data in Ascending and in Descending order.
  • Perform sorting task in all given field name.

Code Implementation


Friday, February 24, 2023

Pagination With Spring Boot, Thyemeleaf, Spring Data JPA, Hibernate, HTML and MySQL

 



In the previous post, we developed a Spring Boot Web Application(User Management System) with Thyemeleaf, HTML, Spring Data JPA, Maven and MySql Database.

Here in this post / video we are going to implement pagination concept in this Web Application.

What is in this article ?

  • Display Total Records (Number of Data present in Database).
  • Total Number of Pages.
  • Implement First Page, Next Page, Last Page and Previous Page concept.
  • Display Number of pages in sequence.



Code Implementation



Implement the code step by step as given below

Saturday, February 18, 2023

Spring Boot Thymeleaf HTML CRUD example


 


Watch This Youtube Video to Understand the Code, Click Here

Here in this article, I'm going to create a Simple CRUD based Web project using Spring Boot, Thymeleaf, Spring Data JPA, Lombok, Maven with MySql Database.

In this project I'm creating an user, updating the user and deleting the user. This article is very useful for who are start creating web pages using Spring boot.

Home Page

Home Page
Watch This Youtube Video to Understand the Code, Click Here

Adding New User Page

Adding an User Page
Watch This Youtube Video to Understand the Code, Click Here


Updating New User Page

Updating an User Page


Steps to create the project.
  1. Open Spring Initializer and fill the details of your project like Maven version , java version, Project name etc. as shown below and add the the required depenedencies.
    • Lombok
    • Thymeleaf
    • MySql Driver
    • Spring Data Jpa
    • Spring Web

    •  
  2. Import the project in your IDE, i'm using intellij IDE.
  3. When import is successfull, you can see the project in left side of the panel.
  4. Expand the Project and packages and add all the classes and Html files and in configure the properties in application.properties files.

  • Configure the application by adding below configuration on application.properties file
spring.datasource.url = jdbc:mysql://localhost:3306/database_name
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql = true

  • Now Create the following classes and HTML files in respective packages as shown in above picture. In this project I'm not create the service class because in this project there is no need of any service class, if you want to add you can add.