Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions WebContent/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

63 changes: 63 additions & 0 deletions WebContent/WEB-INF/spring-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<aop:aspectj-autoproxy />
<context:component-scan
base-package="com.jm3007.learn.spring.rest" />
<mvc:annotation-driven />

<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />
</bean>

<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="org.h2.Driver" />
<property name="jdbcUrl" value="jdbc:h2:~/test" />
<property name="user" value="sa" />
<property name="password" value="" />

<property name="minPoolSize" value="5" />
<property name="maxPoolSize" value="10" />
<property name="maxIdleTime" value="50000" />
</bean>


<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan"
value="com.jm3007.learn.spring.rest.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="connection.autocommit">true</prop>
</props>
</property>
</bean>
<bean id="myTransactionMgr"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<tx:annotation-driven transaction-manager="myTransactionMgr" />

</beans>
5 changes: 5 additions & 0 deletions WebContent/WEB-INF/sql/imp-sql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE JM3007_CUSTOMER(
ID BIGINT PRIMARY KEY AUTO_INCREMENT,
NAME VARCHAR(50),
AGE NUMBER
)
16 changes: 16 additions & 0 deletions WebContent/WEB-INF/view/home.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Welcome!!!</title>
</head>
<body>
<h1>I'm here............. Ok</h1>
<a href="login">Login</a>

<h1>Users</h1>
<a href="users/show-form">Register</a>
</body>
</html>
16 changes: 16 additions & 0 deletions WebContent/WEB-INF/view/login.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Login page</title>
</head>
<body>
<form action="loginSpringWay" method="get">
<input type="text" name="username" placeholder="Enter username" /> <input
type="password" name="password" placeholder="Enter password" /> <input
type="submit" value="Login" />
</form>
</body>
</html>
18 changes: 18 additions & 0 deletions WebContent/WEB-INF/view/user-profile.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>User Profile</title>
</head>
<body>
${user.name}
<br /> ${user.age}
<br /> ${user.gender}
<br />${user.country}
<br />${user.courses}
<br />${user.graduated}
<br />${user.feedback}
</body>
</html>
79 changes: 79 additions & 0 deletions WebContent/WEB-INF/view/user-registration.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.error {
color: red;
}
</style>
<meta charset="ISO-8859-1">
<title>User Registration Form</title>
</head>
<body>
<h1>${msg}</h1>
<form:form action="process-user-registration" method="post"
modelAttribute="user">
<table border="1px">
<tr>
<td>Name</td>
<td><form:input path="name" /> <form:errors path="name"
class="error" /></td>
</tr>
<tr>
<td>Age</td>
<td><form:input path="age" /><form:errors path="age"
class="error" /></td>
</tr>
<tr>
<td>Batch Code</td>
<td><form:input path="batchCode" /><form:errors path="batchCode"
class="error" /></td>
</tr>
<tr>
<td>Date of Birth</td>
<td><form:input path="dob" /><form:errors path="dob"
class="error" /></td>
</tr>
<tr>
<td>Last class Date</td>
<td><form:input path="lastBatchDate" /><form:errors path="lastBatchDate"
class="error" /></td>
</tr>
<tr>
<td>Gender</td>
<td><form:radiobutton value="Male" path="gender" /> Male &nbsp;
<form:radiobutton value="Female" path="gender" /> Female</td>
</tr>
<tr>
<td>Country</td>
<td><form:select path="country">
<form:option value="IND" label="India" />
<form:option value="AUS" label="Australia" />
<form:option value="US" label="Unitate States" />
</form:select></td>
</tr>
<tr>
<td>Courses</td>
<td><form:checkbox path="courses" value="M1" /> Core Java
&nbsp; <form:checkbox path="courses" value="M2" /> Advance Java
&nbsp; <form:checkbox path="courses" value="M3" /> Java Frameworks
&nbsp;</td>
</tr>
<tr>
<td>Are you graduate?</td>
<td><form:checkbox path="graduated" /></td>
</tr>
<tr>
<td>Feedback</td>
<td><form:textarea path="feedback" cols="20" rows="3" /></td>
</tr>
<tr>
<td><input type="reset" value="Reset" /></td>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>

</form:form>
</body>
</html>
26 changes: 26 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
<display-name>JM3007</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config.xml</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
77 changes: 74 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,85 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jm3007</groupId>
<artifactId>learn</artifactId>
<artifactId>JM3007</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>JM3007</name>
<packaging>war</packaging>
<description>Learning Java Frameworks</description>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.2</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.13.Final</version>
</dependency>



<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.6</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-infinispan</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
Expand All @@ -29,6 +93,13 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion src/car.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
color=Green
speed=200
speed=100
Loading