This project archetype is a template for creating a fully functional MVC web application using Hibernate, JSTL and Bootstrap

Overview

MVC-Java-11-Web-Application

Introduction: This project archetype is a template for creating a fully functional MVC web application using Hibernate, JSTL and Bootstrap. It has an automatic database creation, auto initial load of the data, with different variety of users. It also has a checkstyle to check the proper coding of your project immediately right after you enter the code.

preview-xl

Requirements:

• Java v11+

• Maven v3+

• Apache Tomcat v9+

• Your database server of choice (Any DB server. i.e. PostgreSQL, SQLServer, Oracle, DB2, etc.)

• IDE of choice (Eclipse or IntelliJ)

Setup and Configuration:

  1. Download Java JDK.
  2. Download Maven.
  3. Download and configure database.
  4. Download Apache Tomcat
  5. Download and configure IDE
  6. Download the “MVC Hibernate JSTL Bootstrap” maven archetype
  7. Configure you default maven Installation and maven settings. Go to Windows  Preferences  Maven  Installations

image001

  1. Set the maven as default maven installation!

image003

  1. Select the settings.xml from the maven installation folder as the default global settings

image005

  1. Configure Apache Tomcat Server, Under Windows  Preferences  Server  Runtime Environments, click Add button.
  2. Select Apache Tomcat v9.0 and check the “Create a new local server”.

image007

  1. Select your tomcat installation folder and hit Finish button.

image009

  1. Open your IDE and import “MVC Hibernate JSTL Bootstrap” archetype maven project

image011

  1. Create new run configuration. Under Run  Run Configurations, Create new Maven Build.
  2. Set the name of the configuration, select the mvc-hibernate-jstl-bootstrap project and add the goal “clean package install”, then hit Apply and Run.

image013

  1. Success! You can now create you template project from the new mvc-hibernate-jstl-bootstrap maven archetype.

Creating a web project:

  1. Create new maven project.

image015

  1. Hit Next twice.
  2. Select the “mvc-hibernate-jstl-bootstrap” archetype

image016

  1. Set the following required fields: a. Group ID – Company name (i.e. com.sample) b. Artifact ID – Your project name (all small letter) (i.e. sample) c. Version – The initial version of the project (i.e. 1.0) d. contextPath – The default context path of your web project (i.e. sample) e. name – Name of the project to be display in the UI (i.e. Sample) f. description A short description of this project (i.e. Sample web application with Hibernate, JSTL and Bootstrap)

image018

  1. 5 new projects should be created: a. sample – The parent project containing all the four projects. b. sample-beans – Base data model project, contains all the database table with hibernate annotation. (Model) c. sample-formbeans – Request/Response data model for the UI, consist of data model representation for web UI request and response. (View) d. sample-app – Main business logic project. Contains all the logic between the UI and the database. e. sample-ui – Web project, consist of servlets and jsp pages for the web application (Controller)
  2. Create new run configuration, under Run  Run Configuration, create new Maven Build. Enter the configuration name, Select the main project (in this case the “sample” project), then add “clean package install” as the Goals. Hit the Apply and Run button.

image020

You should get the following logs:

image022

  1. To be able to automatically create the tables in the database, you need to create the database and the user that has read/write access to create or drop the database tables and indexes. (If you are using PostgreSQL database, follow the instruction of creating the database below.)
  2. Go to Window  Show View  Servers, add the UI project in the server by right clicking into the server and click Add and Remove. Select the project then click “Add >”. Then hit Finish.
  3. Under the Project Explorer  Servers  , open catalina.properties.
  4. At the bottom of the file, add the following: DB_CREATED=N DEBUG_ENABLE=false SHOW_SQL=false ZONE=America/Winnipeg #DATABASE_HOST_NAME=localhost #DATABASE_PORT=5432 #DATABASE_NAME=sample #DATABASE_USERNAME=sampleadm #DATABASE_PASSWORD=sampleadm

• DB_CREATED  Y to create new database or N to update existing database • DEBUG_ENABLE  true or false to enable debug • SHOW_SQL  true or false to show sql queries in the logs • ZONE  Your default timezone for localization • DATABASE_HOST_NAME  the IP or hostname of the database server • DATABASE_PORT  the port of the database server • DATABASE_NAME  the name of the database • DATABASE_USERNAME  the database user • DATABASE_PASSWORD  the database user password Note: Remove the “#” to uncomment the properties. 11. Right click and start the server. By default, the database tables will be automatically created and an initial set of data will be loaded into the database. a. su/su  the Super User b. root/su  the Regular User c. member/su  the Member of the regular user 12. You can access the website using this url: http://localhost:8080// (i.e., http://localhost:8080/sample/) 13. Enjoy!!!

Creating a user and database on PostgreSQL:

  1. Open PGAdmin
  2. Under PostgreSQL , Right click on Login/Group Roles  Create  Login/Group Role.
  3. Enter the Name under the General tab and the password under the Definition tab. (in this case we use the same username and password for testing purposes, you can put whatever you like.)

image024

  1. Under the Priveleges tab, set the following a. Can login?  YES b. Superuser?  NO c. Create roles?  NO d. Create databases?  YES e. Update catalogs?  NO f. Inherit rights from the parent roles?  YES g. Can initiate streaming replication and backups? NO
  2. Click the “Save” button.
  3. Right click on Databases  Create  Database
  4. Set the database name and select the new created user (i.e. sampleadm) as the owner. Then hist “Save” button.

Setup Project CheckStyle:

  1. Under Windows  Preferences, Select Checkstyle. Click the New button. Select External Configuration File for the Type, enter the name of the checkstyle and navigate to your parent project default folder and look for checkstyle.xml file.

image026

  1. Select the new checkstyle as your default.
  2. On your projects (*-app, *.beans, *.ui), Right click and Properties. Check the “Checkstyle active for this project” and hit “Apply and Close”.

image028

You might also like...

Simple micro web framework written in Pragmatic Functional Java style

Pragmatica REST Example Example nano web framework written in Pragmatic Functional Java style. Example public class App { public static void main(

Oct 21, 2022

A simple Project based on Jsp and Servlets and Hibernate.

A simple Project based on Jsp and Servlets and Hibernate.

Learning Management System in Java In this project, I have created a Simple Learning Management System which is based on Java server pages, Servlet &

Feb 2, 2022

A template for a Forge + Fabric project setup using a Common source set.

MultiLoader Template This project provides a Gradle project template that can compile mods for both Forge and Fabric using a common sourceset. This pr

Jan 5, 2023

This bare project template includes a minimal setup for using unimodules with React Native tvOS.

What This is a clone of expo's bare minimal template which includes a minimal setup for using unimodules with React Native. Additionally, this templat

Dec 25, 2022

A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture.

Snap-Snippet A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture. Tech

Nov 29, 2022

JSON Web Token implementation for Java according to RFC 7519. Easily create, parse and validate JSON Web Tokens using a fluent API.

JWT-Java JSON Web Token library for Java according to RFC 7519. Table of Contents What are JSON Web Tokens? Header Payload Signature Features Supporte

Jul 10, 2022

Another fully updated version of the Homework Planner.

The Homework Planner Description This is another updated version of the homework planner, which is a simple and user-friendly application that allows

Jan 17, 2022

A Fully Code Integrated Dynamic DataBase Management System for the Java Platform

dynamic-database A fully code integrated minimal database management system for Java, Scala, Kotlin or Groovy projects. It is written in Java and can

Jun 8, 2022

The application consists of a web page with a list of some movies. The page allows user interaction through ratings of movies listed in the web app.

The application consists of a web page with a list of some movies. The page allows user interaction through ratings of movies listed in the web app.

DSMovie About the project https://matheus-maia-alvarez-dsmovie.netlify.app/ DSMovie is a full stack web and mobile application built during the Spring

Jul 21, 2022
Comments
  • Bug in google

    Bug in google

    I think the implementation forget to remove duplicates.

    consider following test cases:

    • Test cases:
    • [-1,-1,0,1,2] , 1 -> [-1,-1,0],[-1,0,1],[-1,-1,2],[-1,-1,1]
    • [-1,0,0,0,1,1,1], 1 -> [-1,0,0],[-1,0,1],[0,0,0]
    • [0,0,0,0], 1 -> [0,0,0]

    your output is 5, 13, 4 for these cases

    opened by Edmonddinyuy 0
Owner
null
This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

GowthamRaj K 3 Nov 2, 2021
A simple quarkus app with hibernate as ORM, used to show the features of Hibernate Search

beer-manager-hibernate-search Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, ple

Sedona Solutions 3 Jan 6, 2022
Spring Boot JdbcTemplate example with SQL Server: CRUD Rest API using Spring Data JDBC, Spring Web MVC

Spring Boot JdbcTemplate example with SQL Server: Build CRUD Rest API Build a Spring Boot CRUD Rest API example that uses Spring Data Jdbc to make CRU

null 7 Dec 20, 2022
Human Resource Management Application on JavaFX using MVC Design Pattern

Human-Resource-Management-System-with-JFoenix Human Resource Management Application on JavaFX using MVC Design Pattern Built With Java JavaFX - FXML C

Bahadır Ünal 0 Mar 18, 2022
开源论坛、问答系统,现有功能提问、回复、通知、最新、最热、消除零回复功能。功能持续更新中…… 技术栈 Spring、Spring Boot、MyBatis、MySQL/H2、Bootstrap

码问社区 在线演示地址 www.mawen.co 功能列表 开源论坛、问答系统,现有功能提问、回复、通知、最新、最热、消除零回复功能。功能持续更新中…… 技术栈 技术 链接 Spring Boot http://projects.spring.io/spring-boot/#quick-start

小匠 2.3k Dec 30, 2022
Java 项目快速开发脚手架。核心技术采用 SpringBoot、MyBatis、Thymeleaf、Bootstrap。

前言 闲来无事,整一个 Java 项目快速开发脚手架。 正文 一、简介 Chewing 是一个简单的 Java 项目快速开发脚手架。既适合需要开发小型项目的小伙伴使用,也适合刚入门的新手用来学习一些常用的技术。 二、源码 Github:https://github.com/jingqueyimu/c

null 33 Sep 26, 2022
Multi-Tenant Spring Boot Application with separate databases using Hibernate and H2.

Multi-Tenant Spring Boot Application A Spring Boot application that utilises a multi-tenancy architecture by providing multiple databases, one for eac

Alex Gschnitzer 15 May 9, 2022
An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or to turn an existing project into a devops project using open source software (Git, Docker, Jenkins..)

DevOpsify Description An assistance platform made using Spring framework that analyses your code, and helps you either to start a devops project, or t

obaydah bouifadene 14 Nov 8, 2022
Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Application for creating blog posts, developed with Java using Spring Framework for backend and Angular along with PrimeNG Library for frontend development.

Áureo Carmelino 10 Nov 27, 2022
Java project to explore programming concepts by creating chatting application.

ChitChat - Let's explore programming Abstract ✍️ This project aimed to develop a chatting application from very basic, by exploring the fundamentals o

Sri Manikanta 3 Dec 23, 2022