- A website example using Maven web with Model View Controller structure.
- Backend with PostgreSQL
- Login and register functionality with CRUD operations on users.
- ToDo task with CRUD operations on ToDo page.
- JSP pages with bootstrap.
- Hibernate and entity classes.
- Use Java 1.8
- Create or use a database to give its configuration to hibernate.cfg.xml file.
- Create a hibernate.cfg.xml file under src/main/resources folder with correct mapping and configuration. An example hibernate.cfg.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/YourDatabaseUrl</property>
<property name="connection.username">YourDatabaseUsername</property>
<property name="connection.password">YourDatabasePassword</property>
<property name="connection.pool_size">10</property>
<mapping class="com.clk.model.User"/>
<mapping class="com.clk.model.Task"/>
</session-factory>
</hibernate-configuration>
- Under resources folder, in hibernate.properties file change
hibernate.hbm2ddl.auto=none
to hibernate.hbm2ddl.auto=create
for the first usage while registering a user. After that change back to 'none'.
- Add Apache Tomcat Server and configure with project artifacts.
- Start your database.
- Run Tomcat server
- It will open in a new browser. If not go to http://localhost:8080/JavaMVCWebsite_war/