Skip to content

Practiced JSP, Thymeleaf, Lombok, Hibernate & Spring MVC with XML and Java configurations

Notifications You must be signed in to change notification settings

ksachin7/spring-mvc-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring MVC Practices

Used Dependency Versions

<properties>
    <java.version>17</java.version>
    <spring.version>6.1.7</spring.version>
    <servlet.version>6.0.0</servlet.version>
    <jsp.version>4.0.0-M2</jsp.version>
    <jstl.version>3.0.0</jstl.version>
    <thymeleaf.version>3.1.1.RELEASE</thymeleaf.version>
    <slf4j.version>2.1.0-alpha1</slf4j.version>
    <log4j.version>2.14.1</log4j.version>
    <logback.version>1.5.6</logback.version>
    <hibernate.version>6.5.1.Final</hibernate.version>
    <lombok.version>1.18.30</lombok.version>
  </properties>

Project: spring-mvc-xml(XML Configuration)

This configuration approach utilizes XML files to configure Spring MVC components such as controllers, view resolvers, and handler mappings. It's a traditional method where beans and their dependencies are defined in XML files, offering flexibility and separation of concerns. Spring MVC XML config.

In this project I practiced

  • Setting up tomcat
  • Spring MVC configuration using xml
  • JSP, EL & Bootstrap
  • Passing data to and from controller using Model, ModelMap, and ModelAndView.
  • Initializing and logging with slf4j
  • demonstrated various ways of fetching data from views:
    • Servlet API: Directly use HttpServletRequest and HttpSession.
    • @RequestParam: Extract individual query or form parameters.
    • Command/Model: Object: Bind all form fields to a JavaBean.
    • @PathVariable: Extract values from the URL path.
    • @ModelAttribute: Bind method parameters or return values to model attributes.
    • @CookieValue: Extract data from cookies.

Project: spring-mvc (Java Configuration)

This modern approach uses Java-based configuration classes to set up Spring MVC components. It leverages annotations like @Configuration and @EnableWebMvc to configure the application context, controllers, view resolvers, and other settings. It offers more concise and readable configuration compared to XML. Spring MVC Java config.

In this project I practiced

  • Spring MVC using Java configuration.
  • More complex form handling and persisting data using Hibernate and MySQL.
  • Practiced Thymeleaf, Hibernate, Lombok, etc.
  • Practiced form validation.

See note on