├── springmvc-userlogin
├── .gitignore
├── src
│ ├── main
│ │ ├── java
│ │ │ └── jbr
│ │ │ │ └── springmvc
│ │ │ │ ├── dao
│ │ │ │ ├── UserDao.java
│ │ │ │ └── UserDaoImpl.java
│ │ │ │ ├── service
│ │ │ │ ├── UserService.java
│ │ │ │ └── UserServiceImpl.java
│ │ │ │ ├── model
│ │ │ │ ├── Login.java
│ │ │ │ └── User.java
│ │ │ │ └── controller
│ │ │ │ ├── RegistrationController.java
│ │ │ │ └── LoginController.java
│ │ ├── resources
│ │ │ └── jbr
│ │ │ │ ├── sql
│ │ │ │ └── ddl.sql
│ │ │ │ └── config
│ │ │ │ └── user-beans.xml
│ │ └── webapp
│ │ │ ├── home.jsp
│ │ │ ├── jsp
│ │ │ ├── welcome.jsp
│ │ │ ├── login.jsp
│ │ │ └── register.jsp
│ │ │ └── WEB-INF
│ │ │ ├── spring-mvc-servlet.xml
│ │ │ └── web.xml
│ └── test
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ └── UserServiceTest.java
├── README.md
└── pom.xml
├── springmvc-collections
├── settings.gradle
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── index.jsp
│ │ └── views
│ │ │ ├── map.jsp
│ │ │ └── list.jsp
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ ├── model
│ │ └── Product.java
│ │ ├── config
│ │ ├── AppInitializer.java
│ │ └── AppConfig.java
│ │ ├── controller
│ │ └── ProductController.java
│ │ └── util
│ │ └── ProductUtil.java
├── build.gradle
├── gradlew.bat
└── gradlew
├── springmvc-maven
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── jsp
│ │ │ ├── bye.jsp
│ │ │ └── hello.jsp
│ │ ├── index.jsp
│ │ └── WEB-INF
│ │ │ ├── spring-mvc-servlet.xml
│ │ │ └── web.xml
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ └── HelloController.java
└── pom.xml
├── springmvc-embedded-tomcat
├── gradle.properties
├── .gitignore
├── README.md
├── src
│ └── main
│ │ ├── webapp
│ │ ├── jsp
│ │ │ ├── bye.jsp
│ │ │ └── hello.jsp
│ │ ├── home.jsp
│ │ └── WEB-INF
│ │ │ ├── dispatcher-servlet.xml
│ │ │ └── web.xml
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ └── gradle
│ │ └── HelloController.java
├── settings.gradle
├── build.gradle
├── gradlew.bat
└── gradlew
├── springmvc-helloworld
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── index.jsp
│ │ ├── jsp
│ │ │ └── welcome.jsp
│ │ └── WEB-INF
│ │ │ ├── web.xml
│ │ │ └── springmvc-servlet.xml
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ └── HelloController.java
└── pom.xml
├── springmvc-viewresolvers-Xml
├── .gitignore
├── gradle.properties
├── README.md
├── src
│ └── main
│ │ ├── webapp
│ │ └── WEB-INF
│ │ │ ├── views
│ │ │ ├── user.jsp
│ │ │ └── product.jsp
│ │ │ └── views.xml
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ ├── controller
│ │ └── HomeController.java
│ │ └── config
│ │ ├── AppInitializer.java
│ │ └── AppConfig.java
├── settings.gradle
├── build.gradle
├── gradlew.bat
└── gradlew
├── springmvc-embedded-jetty
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── jsp
│ │ │ ├── bye.jsp
│ │ │ └── hello.jsp
│ │ ├── home.jsp
│ │ └── WEB-INF
│ │ │ ├── dispatcher-servlet.xml
│ │ │ └── web.xml
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ └── gradle
│ │ └── HelloController.java
├── README.md
├── settings.gradle
├── build.gradle
├── gradlew.bat
└── gradlew
├── springmvc-viewresolvers-ContentNegotiating
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── index.jsp
│ │ └── WEB-INF
│ │ │ ├── web.xml
│ │ │ └── views
│ │ │ └── personInfo.jsp
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ ├── view
│ │ ├── PdfViewResolver.java
│ │ ├── ExcelViewResolver.java
│ │ ├── JsonViewResolver.java
│ │ ├── Jaxb2MarshallingXmlViewResolver.java
│ │ ├── PdfView.java
│ │ └── ExcelView.java
│ │ ├── config
│ │ ├── AppInitializer.java
│ │ ├── PersonConfig.java
│ │ └── AppConfig.java
│ │ ├── controller
│ │ ├── RestPersonController.java
│ │ └── PersonController.java
│ │ └── model
│ │ ├── Persons.java
│ │ └── Person.java
├── README.md
└── pom.xml
├── springmvc-jquery
├── .gitignore
├── src
│ └── main
│ │ ├── webapp
│ │ ├── image
│ │ │ ├── up-arrow.jpg
│ │ │ └── down-arrow.jpg
│ │ ├── views
│ │ │ ├── expandedData.jsp
│ │ │ ├── greeting.jsp
│ │ │ ├── expand-collapse.jsp
│ │ │ └── expand-collapse2.jsp
│ │ ├── js
│ │ │ └── app.js
│ │ └── css
│ │ │ └── app.css
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ ├── model
│ │ └── Product.java
│ │ ├── AppInitializer.java
│ │ ├── controller
│ │ └── ProductController.java
│ │ ├── config
│ │ └── AppConfig.java
│ │ └── util
│ │ └── ProductUtil.java
├── README.md
├── settings.gradle
├── build.gradle
├── gradlew.bat
└── gradlew
├── springmvc-viewresolvers-ResourceBundle
├── .gitignore
├── gradle.properties
├── src
│ └── main
│ │ ├── webapp
│ │ ├── index.jsp
│ │ └── WEB-INF
│ │ │ └── views
│ │ │ ├── user.jsp
│ │ │ └── product.jsp
│ │ ├── resources
│ │ └── views.properties
│ │ └── java
│ │ └── jbr
│ │ └── springmvc
│ │ ├── config
│ │ ├── AppInitializer.java
│ │ └── AppConfig.java
│ │ └── controller
│ │ └── HomeController.java
├── README.md
├── settings.gradle
├── build.gradle
├── gradlew.bat
└── gradlew
└── springmvc-gradle
├── .gitignore
├── src
└── main
│ ├── webapp
│ ├── jsp
│ │ ├── bye.jsp
│ │ └── hello.jsp
│ ├── home.jsp
│ └── WEB-INF
│ │ ├── spring-mvc-servlet.xml
│ │ └── web.xml
│ └── java
│ └── jbr
│ └── springmvc
│ └── gradle
│ └── HelloController.java
├── build.gradle
├── settings.gradle
├── gradlew.bat
└── gradlew
/springmvc-userlogin/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /.settings/
--------------------------------------------------------------------------------
/springmvc-collections/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'springmvc-collections'
2 |
--------------------------------------------------------------------------------
/springmvc-maven/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /bin/
3 | /.settings/
4 |
5 | .classpath
6 | .project
--------------------------------------------------------------------------------
/springmvc-collections/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle/
2 | .settings/
3 | bin/
4 |
5 | .classpath
6 | .project
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/gradle.properties:
--------------------------------------------------------------------------------
1 | springVersion=4.3.14.RELEASE
2 | tomcatVersion=8.0.42
--------------------------------------------------------------------------------
/springmvc-helloworld/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /bin/
3 | /.settings/
4 | .classpath
5 | .project
6 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/.gitignore:
--------------------------------------------------------------------------------
1 | .classpath
2 | .project
3 | .settings/
4 | .gradle/
5 | bin/
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/.gitignore:
--------------------------------------------------------------------------------
1 | .settings/
2 | .gradle/
3 | /target/
4 |
5 | .classpath
6 | .project
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | .settings/
3 |
4 | .classpath
5 | .project
--------------------------------------------------------------------------------
/springmvc-jquery/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle/
2 | .settings/
3 | target/
4 | bin/
5 | build/
6 |
7 | .project
8 | .classpath
--------------------------------------------------------------------------------
/springmvc-collections/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 |
3 | .gradle/
4 | .settings/
5 |
6 | .classpath
7 | .project
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/.gitignore:
--------------------------------------------------------------------------------
1 | .project
2 | .classpath
3 | .gradle/
4 | .settings/
5 | /bin/
6 | /target/
7 | **/META-INF/**
8 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. Embedded Tomcat
4 |
5 | ## CONCEPTS COVERED
6 | 1. JdbcTemplate
7 |
--------------------------------------------------------------------------------
/springmvc-gradle/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /build/
3 | /target/
4 | /gradle/
5 | /.settings/
6 | /.gradle/
7 | .classpath
8 | .project
9 | **/META-INF/**
10 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/image/up-arrow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/javabyranjith/spring-framework-mvc/HEAD/springmvc-jquery/src/main/webapp/image/up-arrow.jpg
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/image/down-arrow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/javabyranjith/spring-framework-mvc/HEAD/springmvc-jquery/src/main/webapp/image/down-arrow.jpg
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/gradle.properties:
--------------------------------------------------------------------------------
1 | javaVersion=1.8
2 | springVersion=5.1.0.RELEASE
3 |
4 | junitVersion=4.12
5 |
6 | servletApiVersion=3.1.0
7 | jstlApiVersion=1.2.1
8 | taglibStdVersion=1.1.2
9 | jspApiVersion=2.3.1
10 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/gradle.properties:
--------------------------------------------------------------------------------
1 | javaVersion=1.8
2 | springVersion=5.1.0.RELEASE
3 |
4 | junitVersion=4.12
5 |
6 | servletApiVersion=3.1.0
7 | jstlApiVersion=1.2.1
8 | taglibStdVersion=1.1.2
9 | jspApiVersion=2.3.1
10 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/views/expandedData.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.dao;
2 |
3 | import jbr.springmvc.model.Login;
4 | import jbr.springmvc.model.User;
5 |
6 | public interface UserDao {
7 |
8 | int register(User user);
9 |
10 | User validateUser(Login login);
11 | }
12 |
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/webapp/jsp/bye.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/webapp/jsp/bye.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/webapp/jsp/hello.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-helloworld/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hit Submit
4 |
11 |
12 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/webapp/jsp/hello.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/webapp/jsp/bye.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/webapp/jsp/hello.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/webapp/jsp/bye.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/service/UserService.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.service;
2 |
3 | import jbr.springmvc.model.Login;
4 | import jbr.springmvc.model.User;
5 |
6 | public interface UserService {
7 |
8 | int register(User user);
9 |
10 | User validateUser(Login login);
11 | }
12 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/webapp/jsp/hello.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 | ${message}
9 |
10 |
--------------------------------------------------------------------------------
/springmvc-jquery/README.md:
--------------------------------------------------------------------------------
1 | ### TOOLS & TECHNOLOGIES
2 | 1. Eclipse/STS
3 | 2. Gradle
4 | 3. Spring Framework
5 | 4. jQuery
6 |
7 | ### CONCEPTS/TOPICS COVERED
8 | 1. Expand Collapse with jQuery
9 |
10 | ### HOW TO RUN?
11 | Run As -> Run on Server -> Tomcat Server
12 | http://localhost:8080/springmvc-gralde/
13 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 | Insert title here
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/views/greeting.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | Greeting
8 |
9 |
10 | ${message}
11 |
12 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. Spring 5
4 |
5 | ## TOPICS COVERED
6 | 1. XmlViewResolver
7 | 2. Bean configuration using Annotation
8 |
9 |
10 | ## HOW TO RUN?
11 | 1. http://localhost:8080/springmvc-ViewResolver-XmlViewResolver/product
12 | 2. http://localhost:8080/springmvc-ViewResolver-XmlViewResolver/user
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/webapp/home.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 |
9 |
10 | Say HELLO
11 | Say BYE
12 |
13 |
14 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 |
9 |
10 | Say HELLO
11 | Say BYE
12 |
13 |
14 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/resources/views.properties:
--------------------------------------------------------------------------------
1 | user.(class)=org.springframework.web.servlet.view.JstlView
2 | user.url=/WEB-INF/views/user.jsp
3 |
4 | product.(class)=org.springframework.web.servlet.view.JstlView
5 | product.url=/WEB-INF/views/product.jsp
6 |
7 | userRedirect.(class)=org.springframework.web.servlet.view.JstlView
8 | userRedirect.url=user
9 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/webapp/home.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 |
9 |
10 | Say HELLO
11 | Say BYE
12 |
13 |
14 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/webapp/home.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 | Insert title here
7 |
8 |
9 |
10 | Say HELLO
11 | Say BYE
12 |
13 |
14 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. Spring 5
4 |
5 | ## TOPICS COVERED
6 | 1. ResourceBundleViewResolver
7 | 2. Annotation based bean configuration
8 |
9 | ## HOW TO RUN
10 | 1. http://localhost:8080/springmvc-ViewResolver-ResourceBundleViewResolver/user
11 | 2. http://localhost:8080/springmvc-ViewResolver-ResourceBundleViewResolver/product
12 |
13 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/webapp/WEB-INF/views/user.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | User
8 |
9 |
10 |
11 |
XmlViewResolver
12 |
13 | ${message}
14 |
15 |
--------------------------------------------------------------------------------
/springmvc-jquery/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user guide at https://docs.gradle.org/4.8.1/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = 'springmvc-jquery'
11 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/webapp/WEB-INF/views/product.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | Product
8 |
9 |
10 |
11 |
XmlViewResolver
12 |
13 | ${message}
14 |
15 |
--------------------------------------------------------------------------------
/springmvc-helloworld/src/main/webapp/jsp/welcome.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 | Welcome
8 |
9 | ${message}
10 |
11 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/webapp/WEB-INF/views/user.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | User
8 |
9 |
10 |
11 |
ResourceBundleViewResolver
12 |
13 | ${message}
14 |
15 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/webapp/WEB-INF/views/product.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | Product
8 |
9 |
10 |
11 |
ResourceBundleViewResolver
12 |
13 | ${message}
14 |
15 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user guide at https://docs.gradle.org/4.8.1/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = 'springmvc-ViewResolver-Xml'
11 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | *
6 | * Detailed information about configuring a multi-project build in Gradle can be found
7 | * in the user guide at https://docs.gradle.org/4.8.1/userguide/multi_project_builds.html
8 | */
9 |
10 | rootProject.name = 'springmvc-ViewResolver-ResourceBundle'
11 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. Spring Framework
4 |
5 | ## TOPICS COVERED
6 | 1.
7 |
8 | ## STEPS to run Application
9 | 1. Install Jetty Eclipse Plugin / Run Jetty Plugin
10 | 2. Right click the Application
11 | 3. Run As -> Run Configurations -> Jetty Webapp
12 | 4. WebApp->Context Path
13 | 4.1 Replace / with /spring-mvc-embedded-jetty in
14 | 4.2 Change the port if required
15 | 5. Common
16 | 5.1 Select Run Checkbox
17 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/resources/jbr/sql/ddl.sql:
--------------------------------------------------------------------------------
1 | CREATE DATABASE IF NOT EXISTS spring_mvc;
2 |
3 | USE spring_mvc;
4 |
5 | DROP TABLE IF EXISTS `spring_mvc`.`users`;
6 |
7 | CREATE TABLE `spring_mvc`.`users` (
8 | `username` VARCHAR(45) NOT NULL,
9 | `password` VARCHAR(45) NULL,
10 | `firstname` VARCHAR(45) NOT NULL,
11 | `lastname` VARCHAR(45) NULL,
12 | `email` VARCHAR(45) NULL,
13 | `address` VARCHAR(45) NULL,
14 | `phone` INT NULL,
15 | PRIMARY KEY (`username`));
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/PdfViewResolver.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Locale;
4 |
5 | import org.springframework.web.servlet.View;
6 | import org.springframework.web.servlet.ViewResolver;
7 |
8 | public class PdfViewResolver implements ViewResolver {
9 |
10 | @Override
11 | public View resolveViewName(String viewName, Locale locale) throws Exception {
12 | return new PdfView();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/ExcelViewResolver.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Locale;
4 |
5 | import org.springframework.web.servlet.View;
6 | import org.springframework.web.servlet.ViewResolver;
7 |
8 | public class ExcelViewResolver implements ViewResolver {
9 |
10 | @Override
11 | public View resolveViewName(String viewName, Locale locale) throws Exception {
12 | return new ExcelView();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/springmvc-helloworld/src/main/java/jbr/springmvc/HelloController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.servlet.ModelAndView;
6 |
7 | @Controller
8 | public class HelloController {
9 |
10 | @RequestMapping("/hello")
11 | public ModelAndView hello() {
12 | return new ModelAndView("welcome", "message", "Welcome to Spring MVC using Maven!!!");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/java/jbr/springmvc/model/Product.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import lombok.NoArgsConstructor;
6 | import lombok.Setter;
7 | import lombok.ToString;
8 |
9 | @Getter
10 | @Setter
11 | @AllArgsConstructor
12 | @NoArgsConstructor
13 | @ToString
14 | public class Product {
15 | private String id;
16 | private String name;
17 | private String category;
18 | private String description;
19 | private String price;
20 | }
21 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/java/jbr/springmvc/model/Product.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 |
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 | import lombok.NoArgsConstructor;
7 | import lombok.Setter;
8 | import lombok.ToString;
9 |
10 | @Getter
11 | @Setter
12 | @AllArgsConstructor
13 | @NoArgsConstructor
14 | @ToString
15 | public class Product {
16 | private String id;
17 | private String name;
18 | private String category;
19 | private String description;
20 | private String price;
21 | }
22 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/js/app.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | $(".expandableCollapsibleDiv > img").click(function(e) {
3 | var showElementDescription = $(this).parents(".expandableCollapsibleDiv").find("ul");
4 |
5 | if ($(showElementDescription).is(":visible")) {
6 | showElementDescription.hide("fast", "swing");
7 | $(this).attr("src", "image/up-arrow.jpg");
8 | } else {
9 | showElementDescription.show("fast", "swing");
10 | $(this).attr("src", "image/down-arrow.jpg");
11 | }
12 | });
13 | });
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/model/Login.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 | public class Login {
4 |
5 | private String username;
6 | private String password;
7 |
8 | public String getUsername() {
9 | return username;
10 | }
11 |
12 | public void setUsername(String username) {
13 | this.username = username;
14 | }
15 |
16 | public String getPassword() {
17 | return password;
18 | }
19 |
20 | public void setPassword(String password) {
21 | this.password = password;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/home.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 | Welcome
8 |
9 |
10 |
16 |
17 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. Spring 5
4 |
5 | ## TOPICS COVERED
6 | 1. ContentNegotiatingViewResolver
7 |
8 |
9 | ## HOW TO RUN
10 | #### JSP Response
11 | http://localhost:8080/spring5mvc-view-resolver/persons/ranjith
12 |
13 | #### PDF Response
14 | http://localhost:8080/spring5mvc-view-resolver/persons/ranjith.pdf
15 |
16 | #### JSON Response
17 | http://localhost:8080/spring5mvc-view-resolver/persons/ranjith.json
18 |
19 | #### Excel Response
20 | http://localhost:8080/spring5mvc-view-resolver/persons/ranjith.xslx
21 |
22 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/webapp/WEB-INF/views/personInfo.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1" isELIgnored="false"%>
3 |
4 |
5 |
6 |
7 | Person Info
8 |
9 |
10 |
11 |
12 | NAME
13 | ADDRESS
14 | PHONE
15 |
16 |
17 | ${person.name}
18 | ${person.address}
19 | ${person.phone}
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/service/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 |
5 | import jbr.springmvc.dao.UserDao;
6 | import jbr.springmvc.model.Login;
7 | import jbr.springmvc.model.User;
8 |
9 | public class UserServiceImpl implements UserService {
10 |
11 | @Autowired
12 | public UserDao userDao;
13 |
14 | public int register(User user) {
15 | return userDao.register(user);
16 | }
17 |
18 | public User validateUser(Login login) {
19 | return userDao.validateUser(login);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/jsp/welcome.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 | Welcome
8 |
9 |
10 |
11 |
12 | Welcome ${firstname}
13 |
14 |
15 |
16 |
17 |
18 |
19 | Home
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/css/app.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0 auto;
3 | width: 500px;
4 | }
5 |
6 | .mainDiv {
7 | font-family: Verdana;
8 | font-size: 14px;
9 | padding-left: 20px;
10 | padding-right: 5px;
11 | color: red;
12 | }
13 |
14 | .expandableCollapsibleDiv img {
15 | cursor: pointer;
16 | margin-right: 10px;
17 | margin-top: 5px;
18 | padding-left: 10px;
19 | float: left;
20 | }
21 |
22 | .expandableCollapsibleDiv ul {
23 | border-bottom: 1px solid #000;
24 | clear: both;
25 | list-style: outside none none;
26 | margin: 0;
27 | padding-bottom: 10px;
28 | display: none;
29 | }
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/java/jbr/springmvc/gradle/HelloController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.gradle;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | public class HelloController {
9 |
10 | @RequestMapping("/hello")
11 | public String hello(ModelMap map) {
12 | map.put("message", "HELLO. Welcome to Spring MVC using GRADLE!!!");
13 | return "hello";
14 | }
15 |
16 | @RequestMapping("/bye")
17 | public String bye(ModelMap map) {
18 | map.put("message", "GOOD BYE. Meet you soon!!!");
19 | return "bye";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/java/jbr/springmvc/config/AppInitializer.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
4 |
5 | public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
6 |
7 | @Override
8 | protected Class>[] getRootConfigClasses() {
9 | return null;
10 | }
11 |
12 | @Override
13 | protected Class>[] getServletConfigClasses() {
14 | return new Class[] { AppConfig.class };
15 | }
16 |
17 | @Override
18 | protected String[] getServletMappings() {
19 | return new String[] { "/" };
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springmvc-gradle/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'java'
3 | id 'maven'
4 | id 'eclipse-wtp'
5 | id 'war'
6 | }
7 |
8 | sourceCompatibility = 1.8
9 | targetCompatibility = 1.8
10 |
11 | war {
12 | baseName = 'spring-mvc-gradle'
13 | version = '1.0'
14 | }
15 |
16 |
17 | repositories {
18 | jcenter()
19 | mavenCentral()
20 | }
21 |
22 | dependencies {
23 | compile 'org.springframework:spring-webmvc:5.0.7.RELEASE'
24 | compile 'javax.servlet:javax.servlet-api:4.0.1'
25 | testImplementation 'junit:junit:4.12'
26 | }
27 |
28 | eclipse {
29 | wtp {
30 | component {
31 | contextPath = 'spring-mvc-gradle'
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/java/jbr/springmvc/controller/HomeController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 |
7 | @Controller
8 | public class HomeController {
9 |
10 | @GetMapping("user")
11 | public String user(Model model) {
12 | model.addAttribute("message", "User Page");
13 |
14 | return "user";
15 | }
16 |
17 | @GetMapping("product")
18 | public String product(Model model) {
19 | model.addAttribute("message", "Product Page");
20 |
21 | return "product";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/java/jbr/springmvc/gradle/HelloController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.gradle;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | public class HelloController {
9 |
10 | @RequestMapping("/hello")
11 | public String hello(ModelMap map) {
12 | map.put("message", "HELLO. Welcome to Spring MVC using GRADLE!!!");
13 | return "hello";
14 | }
15 |
16 | @RequestMapping("/bye")
17 | public String bye(ModelMap map) {
18 | map.put("message", "GOOD BYE. Meet you soon!!!");
19 | return "bye";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/java/jbr/springmvc/HelloController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | public class HelloController {
9 |
10 | @RequestMapping("/hello")
11 | public String hello(ModelMap map) {
12 | map.put("message", "HELLO. Welcome to Spring MVC using MAVEN!!!");
13 |
14 | return "hello";
15 | }
16 |
17 | @RequestMapping("/bye")
18 | public String bye(ModelMap map) {
19 | map.put("message", "GOOD BYE. Meet you soon!!!");
20 |
21 | return "bye";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/java/jbr/springmvc/config/AppInitializer.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
4 |
5 | public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
6 |
7 | @Override
8 | protected Class>[] getRootConfigClasses() {
9 | return new Class[] { AppConfig.class };
10 | }
11 |
12 | @Override
13 | protected Class>[] getServletConfigClasses() {
14 | return null;
15 | }
16 |
17 | @Override
18 | protected String[] getServletMappings() {
19 | return new String[] { "/" };
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springmvc-gradle/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'spring-mvc-gradle'
19 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/config/AppInitializer.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
4 |
5 | public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
6 |
7 | @Override
8 | protected Class>[] getRootConfigClasses() {
9 | return new Class[] { AppConfig.class };
10 | }
11 |
12 | @Override
13 | protected Class>[] getServletConfigClasses() {
14 | return null;
15 | }
16 |
17 | @Override
18 | protected String[] getServletMappings() {
19 | return new String[] { "/" };
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/java/jbr/springmvc/config/AppInitializer.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
4 |
5 | public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
6 |
7 | @Override
8 | protected Class>[] getRootConfigClasses() {
9 | return new Class[] { AppConfig.class };
10 | }
11 |
12 | @Override
13 | protected Class>[] getServletConfigClasses() {
14 | return null;
15 | }
16 |
17 | @Override
18 | protected String[] getServletMappings() {
19 | return new String[] { "/" };
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/java/jbr/springmvc/gradle/HelloController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.gradle;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.ModelMap;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 |
7 | @Controller
8 | public class HelloController {
9 |
10 | @RequestMapping("/hello")
11 | public String hello(ModelMap map) {
12 | map.put("message", "HELLO. Welcome to Spring MVC using Embedded Tomcat!!!");
13 | return "hello";
14 | }
15 |
16 | @RequestMapping("/bye")
17 | public String bye(ModelMap map) {
18 | map.put("message", "GOOD BYE. Meet you soon!!!");
19 | return "bye";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'spring-mvc-embedded-jetty'
19 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * This settings file was generated by the Gradle 'init' task.
3 | *
4 | * The settings file is used to specify which projects to include in your build.
5 | * In a single project build this file can be empty or even removed.
6 | *
7 | * Detailed information about configuring a multi-project build in Gradle can be found
8 | * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html
9 | */
10 |
11 | /*
12 | // To declare projects as part of a multi-project build use the 'include' method
13 | include 'shared'
14 | include 'api'
15 | include 'services:webservice'
16 | */
17 |
18 | rootProject.name = 'spring-mvc-embedded-tomcat'
19 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/java/jbr/springmvc/AppInitializer.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc;
2 |
3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
4 |
5 | import jbr.springmvc.config.AppConfig;
6 |
7 | public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
8 |
9 | @Override
10 | protected Class>[] getRootConfigClasses() {
11 | return null;
12 | }
13 |
14 | @Override
15 | protected Class>[] getServletConfigClasses() {
16 | return new Class[] { AppConfig.class };
17 | }
18 |
19 | @Override
20 | protected String[] getServletMappings() {
21 | return new String[] { "/" };
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/JsonViewResolver.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Locale;
4 |
5 | import org.springframework.web.servlet.View;
6 | import org.springframework.web.servlet.ViewResolver;
7 | import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
8 |
9 | public class JsonViewResolver implements ViewResolver {
10 |
11 | @Override
12 | public View resolveViewName(String viewName, Locale locale) throws Exception {
13 | MappingJackson2JsonView jackson2JsonView = new MappingJackson2JsonView();
14 | jackson2JsonView.setPrettyPrint(true);
15 |
16 | return jackson2JsonView;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/springmvc-userlogin/README.md:
--------------------------------------------------------------------------------
1 | ## TOOLS & TECHNOLOGIES
2 | 1. Java 1.8
3 | 2. MySQL DB
4 | 3. Tomcat 8.5
5 |
6 | ## TOPICS COVERED
7 | 1. XML Bean configuration
8 | 2. Autowiring
9 | 3. Annotation
10 | 4. JdbcTemplate
11 |
12 | ## STEPS to run Application
13 |
14 | ### STEP 1:
15 | Create database & table using sql script: /src/main/resources/jbr/sql/ddl.sql
16 |
17 | ### STEP 2:
18 | Download this project from Git and import as Maven Project in Eclipse/STS.
19 |
20 | ### STEP 3:
21 | Download tomcat 8.5 and configure in eclipse.
22 |
23 | ### STEP 4: Run Junit Testcase
24 | Run the junit testcase to ensure your application able to communicate to MySQL DB properly.
25 |
26 | ### STEP 4: Run the application using tomcat server
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/java/jbr/springmvc/controller/HomeController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import org.springframework.stereotype.Controller;
4 | import org.springframework.ui.Model;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 |
7 | @Controller
8 | public class HomeController {
9 |
10 | @GetMapping("user")
11 | public String user(Model model) {
12 | System.out.println("user method");
13 | model.addAttribute("message", "User Page");
14 |
15 | return "user";
16 | }
17 |
18 | @GetMapping("product")
19 | public String product(Model model) {
20 | model.addAttribute("message", "Product Page");
21 |
22 | return "product";
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/controller/RestPersonController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import java.util.Arrays;
4 |
5 | import org.springframework.stereotype.Controller;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.ResponseBody;
8 |
9 | import jbr.springmvc.model.Person;
10 | import jbr.springmvc.model.Persons;
11 |
12 | @Controller
13 | public class RestPersonController {
14 |
15 | @RequestMapping("/rest-persons")
16 | @ResponseBody
17 | public Persons getPersons() {
18 | Persons pers = new Persons();
19 | pers.addPersons(Arrays.asList(new Person("kumar")));
20 |
21 | return pers;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'war'
3 | apply plugin: 'eclipse-wtp'
4 | apply plugin: 'jetty'
5 |
6 | sourceCompatibility = 1.8
7 | targetCompatibility = 1.8
8 |
9 | repositories {
10 | jcenter()
11 | mavenCentral()
12 | }
13 |
14 | dependencies {
15 | compile 'org.springframework:spring-webmvc:5.0.7.RELEASE'
16 | compile 'javax.servlet:javax.servlet-api:3.1.0'
17 | testImplementation 'junit:junit:4.12'
18 | }
19 |
20 | jettyRun{
21 | contextPath = "spring-jetty"
22 | httpPort = 9090
23 | }
24 |
25 | jettyRunWar{
26 | contextPath = "spring-jetty"
27 | httpPort = 9090
28 | }
29 |
30 | eclipse {
31 | wtp {
32 | component {
33 | contextPath = 'spring-jetty-wtp'
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'eclipse'
4 | apply plugin: 'war'
5 | apply plugin: 'com.bmuschko.tomcat'
6 |
7 | war {
8 | baseName = 'spring-mvc-embedded-tomcat'
9 | version = '1.0'
10 | }
11 |
12 | repositories {
13 | jcenter()
14 | mavenCentral()
15 | }
16 |
17 | dependencies {
18 | compile 'org.springframework:spring-webmvc:5.0.7.RELEASE'
19 | compile 'javax.servlet:javax.servlet-api:4.0.1'
20 | testImplementation 'junit:junit:4.12'
21 | }
22 |
23 | tomcat {
24 | httpPort = 8090
25 | }
26 |
27 | buildscript {
28 | repositories {
29 | jcenter();
30 | }
31 |
32 | dependencies {
33 | classpath 'com.bmuschko:gradle-tomcat-plugin:2.4.2'
34 | }
35 | }
--------------------------------------------------------------------------------
/springmvc-collections/src/main/webapp/views/map.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
3 |
4 |
5 |
6 |
7 | Map
8 |
9 |
10 |
11 |
12 |
13 |
14 | ID
15 | NAME
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/springmvc-helloworld/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
5 | Archetype Created Web Application
6 |
7 |
8 | index.jsp
9 |
10 |
11 |
12 | springmvc
13 | org.springframework.web.servlet.DispatcherServlet
14 | 1
15 |
16 |
17 | springmvc
18 | /
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-jquery/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'eclipse'
4 | apply plugin: 'war'
5 |
6 | sourceCompatibility = '1.8'
7 | targetCompatibility = '1.8'
8 |
9 |
10 | war {
11 | baseName = 'springmvc-jquery'
12 | version = '1.0'
13 | }
14 |
15 | repositories {
16 | jcenter()
17 | mavenCentral()
18 | }
19 |
20 | dependencies {
21 | compile 'org.springframework:spring-webmvc:5.2.4.RELEASE'
22 | compile 'org.projectlombok:lombok:1.18.12'
23 |
24 | compile 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1'
25 | compile 'taglibs:standard:1.1.2'
26 | compile 'javax.servlet:javax.servlet-api:3.1.0'
27 | compile 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.1'
28 | }
29 |
30 | buildscript {
31 | repositories {
32 | jcenter()
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/webapp/WEB-INF/views.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/springmvc-collections/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'eclipse'
4 | apply plugin: 'war'
5 |
6 | sourceCompatibility = '1.8'
7 | targetCompatibility = '1.8'
8 |
9 |
10 | war {
11 | baseName = 'springmvc-collections'
12 | version = '1.0'
13 | }
14 |
15 | repositories {
16 | jcenter()
17 | mavenCentral()
18 | }
19 |
20 | dependencies {
21 | compile 'org.springframework:spring-webmvc:5.1.0.RELEASE'
22 | compile 'org.projectlombok:lombok:1.18.12'
23 |
24 | compile 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1'
25 | compile 'taglibs:standard:1.1.2'
26 | compile 'javax.servlet:javax.servlet-api:3.1.0'
27 | compile 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.1'
28 |
29 | compile 'junit:junit:4.12'
30 | }
31 |
32 | buildscript {
33 | repositories {
34 | jcenter()
35 | }
36 | }
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/webapp/WEB-INF/spring-mvc-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-helloworld/src/main/webapp/WEB-INF/springmvc-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/webapp/WEB-INF/spring-mvc-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/webapp/WEB-INF/dispatcher-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/webapp/WEB-INF/dispatcher-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/Jaxb2MarshallingXmlViewResolver.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Locale;
4 |
5 | import org.springframework.oxm.Marshaller;
6 | import org.springframework.web.servlet.View;
7 | import org.springframework.web.servlet.ViewResolver;
8 | import org.springframework.web.servlet.view.xml.MarshallingView;
9 |
10 | public class Jaxb2MarshallingXmlViewResolver implements ViewResolver {
11 |
12 | private Marshaller marshaller;
13 |
14 | public Jaxb2MarshallingXmlViewResolver(Marshaller marshaller) {
15 | this.marshaller = marshaller;
16 | }
17 |
18 | @Override
19 | public View resolveViewName(String viewName, Locale locale) throws Exception {
20 | MarshallingView marshallingView = new MarshallingView();
21 | marshallingView.setMarshaller(marshaller);
22 |
23 | return marshallingView;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/model/Persons.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.List;
6 |
7 | import javax.xml.bind.annotation.XmlAccessType;
8 | import javax.xml.bind.annotation.XmlAccessorType;
9 | import javax.xml.bind.annotation.XmlElement;
10 | import javax.xml.bind.annotation.XmlRootElement;
11 |
12 | @XmlRootElement
13 | @XmlAccessorType(XmlAccessType.FIELD)
14 | public class Persons {
15 |
16 | @XmlElement(name = "persons")
17 | private List persons = new ArrayList<>();
18 |
19 | public List getPersons() {
20 | return persons;
21 | }
22 |
23 | public void setPersons(List persons) {
24 | this.persons = persons;
25 | }
26 |
27 | public void addPersons(Collection persons) {
28 | this.persons.addAll(persons);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/java/jbr/springmvc/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7 | import org.springframework.web.servlet.view.InternalResourceViewResolver;
8 | import org.springframework.web.servlet.view.JstlView;
9 |
10 | @Configuration
11 | @EnableWebMvc
12 | @ComponentScan(basePackages = { "jbr.springmvc" })
13 | public class AppConfig {
14 |
15 | @Bean
16 | public InternalResourceViewResolver resolver() {
17 | InternalResourceViewResolver resolver = new InternalResourceViewResolver();
18 | resolver.setViewClass(JstlView.class);
19 | resolver.setPrefix("/views/");
20 | resolver.setSuffix(".jsp");
21 |
22 | return resolver;
23 | }
24 | }
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/WEB-INF/spring-mvc-servlet.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'eclipse'
4 | apply plugin: 'war'
5 |
6 | sourceCompatibility = javaVersion
7 | targetCompatibility = javaVersion
8 |
9 | war {
10 | baseName = 'springmvc-ViewResolver-XmlViewResolver'
11 | version = '1.0'
12 | }
13 |
14 | repositories {
15 | jcenter()
16 | mavenCentral()
17 | }
18 |
19 | dependencies {
20 | // Servlet-JSP dependencies
21 | compile "javax.servlet:javax.servlet-api:$servletApiVersion"
22 | compile "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlApiVersion"
23 | compile "taglibs:standard:$taglibStdVersion"
24 | compile "javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion"
25 |
26 | // Spring Dependency
27 | compile "org.springframework:spring-webmvc:$springVersion"
28 |
29 | testImplementation "junit:junit:$junitVersion"
30 | }
31 |
32 | buildscript {
33 | repositories {
34 | jcenter()
35 | }
36 | }
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 | apply plugin: 'maven'
3 | apply plugin: 'eclipse'
4 | apply plugin: 'war'
5 |
6 | sourceCompatibility = javaVersion
7 | targetCompatibility = javaVersion
8 |
9 | war {
10 | baseName = 'springmvc-ViewResolver-ResourceBundleViewResolver'
11 | version = '1.0'
12 | }
13 |
14 | repositories {
15 | jcenter()
16 | mavenCentral()
17 | }
18 |
19 | dependencies {
20 | // Servlet-JSP dependencies
21 | compile "javax.servlet:javax.servlet-api:$servletApiVersion"
22 | compile "javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:$jstlApiVersion"
23 | compile "taglibs:standard:$taglibStdVersion"
24 | compile "javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion"
25 |
26 | // Spring Dependency
27 | compile "org.springframework:spring-webmvc:$springVersion"
28 |
29 | testImplementation "junit:junit:$junitVersion"
30 | }
31 |
32 | buildscript {
33 | repositories {
34 | jcenter()
35 | }
36 | }
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/java/jbr/springmvc/controller/ProductController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.Model;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 |
10 | import jbr.springmvc.model.Product;
11 | import jbr.springmvc.util.ProductUtil;
12 |
13 | @Controller
14 | public class ProductController {
15 |
16 | @GetMapping("/")
17 | public String expandcollapse(Model model) {
18 | List> productList = Arrays.asList(ProductUtil.mobiles(), ProductUtil.laptops(), ProductUtil.tablets(),
19 | ProductUtil.televisions(), ProductUtil.washers());
20 | model.addAttribute("productList", productList);
21 |
22 | return "expand-collapse";
23 | }
24 |
25 | @GetMapping({ "/welcome", "/hello" })
26 | public String hello(Model model) {
27 | model.addAttribute("message", "Hello. Welcome!!");
28 |
29 | return "greeting";
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/config/PersonConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 |
9 | import jbr.springmvc.model.Person;
10 |
11 | @Configuration
12 | public class PersonConfig {
13 |
14 | @Bean
15 | public String[] strArray(){
16 | return new String[]{"two", "three", "four"};
17 | }
18 |
19 | @Bean
20 | public Map personList() {
21 | Map persons = new HashMap<>();
22 |
23 | Person ranjith = new Person();
24 | ranjith.setName("ranjith");
25 | ranjith.setAddress("chennai");
26 | ranjith.setPhone(98989);
27 | persons.put("ranjith", ranjith);
28 |
29 | Person kabilan = new Person();
30 | kabilan.setName("kabilan");
31 | kabilan.setAddress("hydrabad");
32 | kabilan.setPhone(77777);
33 | persons.put("kabilan", kabilan);
34 |
35 | return persons;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/springmvc-gradle/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Archetype Created Web Application
8 |
9 |
10 | home.jsp
11 |
12 |
13 |
14 | spring-mvc
15 | org.springframework.web.servlet.DispatcherServlet
16 | 1
17 |
18 |
19 | spring-mvc
20 | /
21 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/springmvc-maven/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Archetype Created Web Application
8 |
9 |
10 | index.jsp
11 |
12 |
13 |
14 | spring-mvc
15 | org.springframework.web.servlet.DispatcherServlet
16 | 1
17 |
18 |
19 | spring-mvc
20 | /
21 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Archetype Created Web Application
8 |
9 |
10 | home.jsp
11 |
12 |
13 |
14 | dispatcher
15 | org.springframework.web.servlet.DispatcherServlet
16 | 1
17 |
18 |
19 | dispatcher
20 | /
21 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Archetype Created Web Application
8 |
9 |
10 | home.jsp
11 |
12 |
13 |
14 | dispatcher
15 | org.springframework.web.servlet.DispatcherServlet
16 | 1
17 |
18 |
19 | dispatcher
20 | /
21 |
22 |
23 |
26 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Archetype Created Web Application
8 |
9 |
10 | home.jsp
11 |
12 |
13 |
14 | spring-mvc
15 | org.springframework.web.servlet.DispatcherServlet
16 | 1
17 |
18 |
19 | spring-mvc
20 | /
21 |
22 |
23 |
31 |
32 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/PdfView.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Map;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpServletResponse;
7 |
8 | import org.springframework.web.servlet.view.document.AbstractPdfView;
9 |
10 | import com.lowagie.text.Document;
11 | import com.lowagie.text.pdf.PdfPTable;
12 | import com.lowagie.text.pdf.PdfWriter;
13 |
14 | import jbr.springmvc.model.Person;
15 |
16 | public class PdfView extends AbstractPdfView {
17 |
18 | @Override
19 | protected void buildPdfDocument(Map model, Document document, PdfWriter writer,
20 | HttpServletRequest request, HttpServletResponse response) throws Exception {
21 |
22 | PdfPTable pdfPTable = new PdfPTable(3);
23 |
24 | pdfPTable.addCell("Name");
25 | pdfPTable.addCell("Address");
26 | pdfPTable.addCell("Phone");
27 |
28 | Person person = (Person) model.get("person");
29 | pdfPTable.addCell(person.getName());
30 | pdfPTable.addCell(person.getAddress());
31 | pdfPTable.addCell(String.valueOf(person.getPhone()));
32 |
33 | document.add(pdfPTable);
34 | }
35 | }
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/views/expand-collapse.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
3 |
4 |
5 |
6 |
7 |
8 | Expand/Collapse
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | E/C
20 | ID
21 | CATEGORY
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | ${product.id}
30 | ${product.name}
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/model/Person.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 | import javax.xml.bind.annotation.XmlAccessType;
4 | import javax.xml.bind.annotation.XmlAccessorType;
5 | import javax.xml.bind.annotation.XmlElement;
6 | import javax.xml.bind.annotation.XmlRootElement;
7 |
8 | @XmlRootElement(name = "person")
9 | @XmlAccessorType(XmlAccessType.FIELD)
10 | public class Person {
11 |
12 | private String name;
13 | private String address;
14 | private int phone;
15 |
16 | public Person() {
17 | }
18 |
19 | public Person(String name) {
20 | this.name = name;
21 | this.address = "chennai";
22 | this.phone = 86868;
23 | }
24 |
25 | public String getName() {
26 | return name;
27 | }
28 |
29 | @XmlElement
30 | public void setName(String name) {
31 | this.name = name;
32 | }
33 |
34 | public String getAddress() {
35 | return address;
36 | }
37 |
38 | @XmlElement
39 | public void setAddress(String address) {
40 | this.address = address;
41 | }
42 |
43 | public int getPhone() {
44 | return phone;
45 | }
46 |
47 | @XmlElement
48 | public void setPhone(int phone) {
49 | this.phone = phone;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/controller/PersonController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import java.util.Map;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.ui.ModelMap;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 | import org.springframework.web.bind.annotation.PathVariable;
10 |
11 | import jbr.springmvc.model.Person;
12 |
13 | @Controller
14 | public class PersonController {
15 |
16 | @Autowired
17 | private Map personList;
18 |
19 | @GetMapping(value = "/persons/{personsName}")
20 | public String getPersons(@PathVariable String personsName, ModelMap model) {
21 | System.out.println(personList.get(personsName).getAddress());
22 | model.addAttribute("person", personList.get(personsName));
23 |
24 | return "personInfo";
25 | }
26 |
27 | @GetMapping(value = "/person/{personName}")
28 | public String getPerson(@PathVariable("personName") String name, ModelMap model) {
29 | System.out.println(personList.get(name).getAddress());
30 | model.addAttribute("person", personList.get(name));
31 |
32 | return "personInfo";
33 | }
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/webapp/views/list.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 | <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
3 |
4 |
5 |
6 |
7 | List
8 |
9 |
10 | Product Names:
11 |
16 |
17 | Product Objects:
18 |
19 |
20 |
21 | ID
22 | NAME
23 | CATEGORY
24 | PRICE
25 | DESCRIPTION
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/src/main/java/jbr/springmvc/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.context.MessageSource;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.ComponentScan;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.context.support.ResourceBundleMessageSource;
8 | import org.springframework.web.servlet.ViewResolver;
9 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
11 | import org.springframework.web.servlet.view.ResourceBundleViewResolver;
12 |
13 | @Configuration
14 | @EnableWebMvc
15 | @ComponentScan(basePackages = { "jbr.springmvc" })
16 | public class AppConfig implements WebMvcConfigurer {
17 |
18 | @Bean
19 | public ViewResolver viewResolver() {
20 | ResourceBundleViewResolver viewResolver = new ResourceBundleViewResolver();
21 | viewResolver.setBasename("views");
22 |
23 | return viewResolver;
24 | }
25 |
26 | @Bean
27 | public MessageSource messageSource() {
28 | ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
29 | messageSource.setBasename("messages");
30 |
31 | return messageSource;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/resources/jbr/config/user-beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/jsp/login.jsp:
--------------------------------------------------------------------------------
1 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
2 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
3 | pageEncoding="ISO-8859-1"%>
4 |
5 |
6 |
7 |
8 | Login
9 |
10 |
11 |
12 |
14 |
15 |
16 | Username:
17 |
18 |
19 |
20 | Password:
21 |
23 |
24 |
25 |
26 | Login
27 |
28 |
29 |
30 |
31 |
32 | Home
33 |
34 |
35 |
36 |
37 |
38 | ${message}
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/java/jbr/springmvc/controller/ProductController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 | import java.util.Map;
6 | import java.util.stream.Collectors;
7 |
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.ui.Model;
10 | import org.springframework.web.bind.annotation.GetMapping;
11 |
12 | import jbr.springmvc.model.Product;
13 | import jbr.springmvc.util.ProductUtil;
14 |
15 | @Controller
16 | public class ProductController {
17 |
18 | @GetMapping("/list")
19 | public String list(Model model) throws IOException {
20 |
21 | List productsObject = ProductUtil.generateProductObjectList();
22 | List productsName = productsObject.stream().map(e -> e.getName()).collect(Collectors.toList());
23 |
24 | model.addAttribute("productsObject", productsObject);
25 | model.addAttribute("productsName", productsName);
26 | return "list";
27 | }
28 |
29 | @GetMapping("/map")
30 | public String map(Model model) throws IOException {
31 |
32 | List productsObject = ProductUtil.generateProductObjectList();
33 | Map productsMap = productsObject.stream()
34 | .collect(Collectors.toMap(Product::getId, Product::getName));
35 |
36 | model.addAttribute("productsMap", productsMap);
37 | return "map";
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/springmvc-collections/src/main/java/jbr/springmvc/util/ProductUtil.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.util;
2 |
3 | import java.io.IOException;
4 | import java.util.Arrays;
5 | import java.util.List;
6 |
7 | import jbr.springmvc.model.Product;
8 |
9 | public class ProductUtil {
10 |
11 | public static List generateProductObjectList() throws IOException {
12 |
13 | List products = Arrays.asList(new Product("101", "Samsung J7", "Mobile", "Samsung smart phone", "7000"),
14 | new Product("102", "Realme J10", "Mobile", "Redmi smart phone", "9000"),
15 | new Product("201", "Acer T43", "Laptop", "Acer gaming laptop", "41000"),
16 | new Product("202", "Dell 300", "Laptop", "Dell Vostro laptop", "71000"),
17 | new Product("301", "Samsung Tab 10", "Tablet", "Samsung multimedia Tablet PC", "21000"),
18 | new Product("302", "Levono Tab 4D", "Tablet", "Lenovo Tablet PC", "33000"),
19 | new Product("401", "LG Television", "Television", "LG Smart TV 32", "15000"),
20 | new Product("402", "Samsung Television", "Television", "Samsung Smart TV 41", "35000"), new Product("501",
21 | "Simens Washing Machine", "Washing machine", "Simens heavy load washing machine 6.5kg", "25000"),
22 | new Product("502", "LG Washing Machine", "Washing machine", "LG washing machine 5.5kg", "15000"));
23 | System.out.println(products.size());
24 | return products;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/java/jbr/springmvc/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
7 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9 | import org.springframework.web.servlet.view.InternalResourceViewResolver;
10 | import org.springframework.web.servlet.view.JstlView;
11 |
12 | @Configuration
13 | @EnableWebMvc
14 | @ComponentScan(basePackages = { "jbr.springmvc" })
15 | public class AppConfig implements WebMvcConfigurer {
16 |
17 | @Bean
18 | public InternalResourceViewResolver resolver() {
19 | InternalResourceViewResolver resolver = new InternalResourceViewResolver();
20 | resolver.setViewClass(JstlView.class);
21 | resolver.setPrefix("/views/");
22 | resolver.setSuffix(".jsp");
23 |
24 | return resolver;
25 | }
26 |
27 | public void addResourceHandlers(final ResourceHandlerRegistry registry) {
28 | registry.addResourceHandler("/js/**").addResourceLocations("/js/");
29 | registry.addResourceHandler("/css/**").addResourceLocations("/css/");
30 | registry.addResourceHandler("/image/**").addResourceLocations("/image/");
31 | }
32 | }
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/controller/RegistrationController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpServletResponse;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.ModelAttribute;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RequestMethod;
11 | import org.springframework.web.servlet.ModelAndView;
12 |
13 | import jbr.springmvc.model.User;
14 | import jbr.springmvc.service.UserService;
15 |
16 | @Controller
17 | public class RegistrationController {
18 | @Autowired
19 | public UserService userService;
20 |
21 | @RequestMapping(value = "/register", method = RequestMethod.GET)
22 | public ModelAndView showRegister(HttpServletRequest request, HttpServletResponse response) {
23 | ModelAndView mav = new ModelAndView("register");
24 | mav.addObject("user", new User());
25 |
26 | return mav;
27 | }
28 |
29 | @RequestMapping(value = "/registerProcess", method = RequestMethod.POST)
30 | public ModelAndView addUser(HttpServletRequest request, HttpServletResponse response,
31 | @ModelAttribute("user") User user) {
32 |
33 | userService.register(user);
34 |
35 | return new ModelAndView("welcome", "firstname", user.getFirstname());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/test/java/jbr/springmvc/UserServiceTest.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 | import org.junit.runner.RunWith;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.test.context.ContextConfiguration;
8 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
9 |
10 | import jbr.springmvc.model.Login;
11 | import jbr.springmvc.model.User;
12 | import jbr.springmvc.service.UserService;
13 |
14 | @RunWith(SpringJUnit4ClassRunner.class)
15 | @ContextConfiguration(locations = { "classpath:jbr/config/user-beans.xml" })
16 | public class UserServiceTest {
17 |
18 | @Autowired
19 | private UserService userService;
20 |
21 | @Test
22 | public void testRegister() {
23 | User user = new User();
24 | user.setUsername("ranjith");
25 | user.setPassword("sekar");
26 | user.setFirstname("Ranjith");
27 | user.setLastname("Sekar");
28 | user.setAddress("chennai, t.nagar");
29 | user.setEmail("ranjith@gmail.com");
30 | user.setPhone(222);
31 |
32 | int result = userService.register(user);
33 | Assert.assertEquals(1, result);
34 | }
35 |
36 | @Test
37 | public void testValidateUser() {
38 | Login login = new Login();
39 | login.setUsername("ranjith");
40 | login.setPassword("sekar");
41 |
42 | User user = userService.validateUser(login);
43 | Assert.assertEquals("Ranjith", user.getFirstname());
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/springmvc-maven/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | jbr.springmvc
6 | spring-mvc-maven
7 | war
8 | 0.1
9 | spring-mvc-maven Maven Webapp
10 | http://maven.apache.org
11 |
12 |
13 | 1.8
14 |
15 |
16 |
17 |
18 | org.springframework
19 | spring-webmvc
20 | 5.0.7.RELEASE
21 |
22 |
23 | javax.servlet
24 | javax.servlet-api
25 | 4.0.1
26 |
27 |
28 | junit
29 | junit
30 | 3.8.1
31 | test
32 |
33 |
34 |
35 |
36 | spring-mvc-maven
37 |
38 |
39 | org.apache.maven.plugins
40 | maven-compiler-plugin
41 |
42 | ${java.version}
43 | ${java.version}
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/webapp/views/expand-collapse2.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
2 |
3 |
4 |
5 |
6 |
7 | Expand/Collapse
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
26 |
27 |
28 |
29 |
32 |
38 |
39 |
40 |
41 |
44 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/view/ExcelView.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.view;
2 |
3 | import java.util.Map;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpServletResponse;
7 |
8 | import org.apache.poi.ss.usermodel.Row;
9 | import org.apache.poi.ss.usermodel.Sheet;
10 | import org.apache.poi.ss.usermodel.Workbook;
11 | import org.springframework.web.servlet.view.document.AbstractXlsxView;
12 |
13 | import jbr.springmvc.model.Person;
14 |
15 | public class ExcelView extends AbstractXlsxView {
16 |
17 | @Override
18 | protected void buildExcelDocument(Map model, Workbook workbook, HttpServletRequest request,
19 | HttpServletResponse response) throws Exception {
20 |
21 | Sheet sheet = workbook.createSheet("persons");
22 |
23 | int rowCount = 0;
24 | int columnCount = 0;
25 |
26 | // Create header cells
27 | Row row = sheet.createRow(rowCount++);
28 | row.createCell(columnCount++).setCellValue("Name");
29 | row.createCell(columnCount++).setCellValue("Address");
30 | row.createCell(columnCount++).setCellValue("Phone");
31 |
32 | // Create data cells
33 | row = sheet.createRow(rowCount++);
34 | columnCount = 0;
35 | Person person = (Person) model.get("person");
36 | row.createCell(columnCount++).setCellValue(person.getName());
37 | row.createCell(columnCount++).setCellValue(person.getAddress());
38 | row.createCell(columnCount++).setCellValue(person.getPhone());
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/springmvc-jquery/src/main/java/jbr/springmvc/util/ProductUtil.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.util;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import jbr.springmvc.model.Product;
7 |
8 | public class ProductUtil {
9 |
10 | public static List mobiles() {
11 | return Arrays.asList(new Product("101", "Samsung J7", "Mobile", "Samsung smart phone", "7000"),
12 | new Product("102", "Realme J10", "Mobile", "Redmi smart phone", "9000"));
13 | }
14 |
15 | public static List laptops() {
16 | return Arrays.asList(new Product("201", "Acer T43", "Laptop", "Acer gaming laptop", "41000"),
17 | new Product("202", "Dell 300", "Laptop", "Dell Vostro laptop", "71000"));
18 | }
19 |
20 | public static List tablets() {
21 | return Arrays.asList(new Product("301", "Samsung Tab 10", "Tablet", "Samsung multimedia Tablet PC", "21000"),
22 | new Product("302", "Levono Tab 4D", "Tablet", "Lenovo Tablet PC", "33000"));
23 | }
24 |
25 | public static List televisions() {
26 | return Arrays.asList(new Product("401", "LG Television", "Television", "LG Smart TV 32", "15000"),
27 | new Product("402", "Samsung Television", "Television", "Samsung Smart TV 41", "35000"));
28 | }
29 |
30 | public static List washers() {
31 | return Arrays
32 | .asList(
33 | new Product("501", "Simens Washing Machine", "Washing machine", "Simens heavy load washing machine 6.5kg",
34 | "25000"),
35 | new Product("502", "LG Washing Machine", "Washing machine", "LG washing machine 5.5kg", "15000"));
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/src/main/java/jbr/springmvc/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import org.springframework.context.MessageSource;
4 | import org.springframework.context.ResourceLoaderAware;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.ComponentScan;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.context.support.ResourceBundleMessageSource;
9 | import org.springframework.core.io.ResourceLoader;
10 | import org.springframework.web.servlet.ViewResolver;
11 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
12 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
13 | import org.springframework.web.servlet.view.XmlViewResolver;
14 |
15 | @Configuration
16 | @EnableWebMvc
17 | @ComponentScan(basePackages = { "jbr.springmvc" })
18 | public class AppConfig implements WebMvcConfigurer, ResourceLoaderAware {
19 |
20 | private ResourceLoader resourceLoader;
21 |
22 | @Bean
23 | public ViewResolver viewResolver() {
24 | XmlViewResolver viewResolver = new XmlViewResolver();
25 | viewResolver.setLocation(resourceLoader.getResource("/WEB-INF/views.xml"));
26 | return viewResolver;
27 | }
28 |
29 | @Bean
30 | public MessageSource messageSource() {
31 | ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
32 | messageSource.setBasename("messages");
33 |
34 | return messageSource;
35 | }
36 |
37 | @Override
38 | public void setResourceLoader(ResourceLoader resourceLoader) {
39 | this.resourceLoader = resourceLoader;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/model/User.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.model;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String firstname;
8 | private String lastname;
9 | private String email;
10 | private String address;
11 | private int phone;
12 |
13 | public String getUsername() {
14 | return username;
15 | }
16 |
17 | public void setUsername(String username) {
18 | System.out.println("username: " + username);
19 | this.username = username;
20 | }
21 |
22 | public String getPassword() {
23 | return password;
24 | }
25 |
26 | public void setPassword(String password) {
27 | this.password = password;
28 | }
29 |
30 | public String getFirstname() {
31 | return firstname;
32 | }
33 |
34 | public void setFirstname(String firstname) {
35 | System.out.println("firstname: " + firstname);
36 | this.firstname = firstname;
37 | }
38 |
39 | public String getLastname() {
40 | return lastname;
41 | }
42 |
43 | public void setLastname(String lastname) {
44 | System.out.println("lastname: " + lastname);
45 | this.lastname = lastname;
46 | }
47 |
48 | public String getEmail() {
49 | return email;
50 | }
51 |
52 | public void setEmail(String email) {
53 | this.email = email;
54 | }
55 |
56 | public String getAddress() {
57 | return address;
58 | }
59 |
60 | public void setAddress(String address) {
61 | this.address = address;
62 | }
63 |
64 | public int getPhone() {
65 | return phone;
66 | }
67 |
68 | public void setPhone(int phone) {
69 | this.phone = phone;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/controller/LoginController.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.controller;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpServletResponse;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.ModelAttribute;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RequestMethod;
11 | import org.springframework.web.servlet.ModelAndView;
12 |
13 | import jbr.springmvc.model.Login;
14 | import jbr.springmvc.model.User;
15 | import jbr.springmvc.service.UserService;
16 |
17 | @Controller
18 | public class LoginController {
19 |
20 | @Autowired
21 | UserService userService;
22 |
23 | @RequestMapping(value = "/login", method = RequestMethod.GET)
24 | public ModelAndView showLogin(HttpServletRequest request, HttpServletResponse response) {
25 | ModelAndView mav = new ModelAndView("login");
26 | mav.addObject("login", new Login());
27 |
28 | return mav;
29 | }
30 |
31 | @RequestMapping(value = "/loginProcess", method = RequestMethod.POST)
32 | public ModelAndView loginProcess(HttpServletRequest request, HttpServletResponse response,
33 | @ModelAttribute("login") Login login) {
34 | ModelAndView mav = null;
35 |
36 | User user = userService.validateUser(login);
37 |
38 | if (null != user) {
39 | mav = new ModelAndView("welcome");
40 | mav.addObject("firstname", user.getFirstname());
41 | } else {
42 | mav = new ModelAndView("login");
43 | mav.addObject("message", "Username or Password is wrong!!");
44 | }
45 |
46 | return mav;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/java/jbr/springmvc/dao/UserDaoImpl.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.dao;
2 |
3 | import java.sql.ResultSet;
4 | import java.sql.SQLException;
5 | import java.util.List;
6 |
7 | import javax.sql.DataSource;
8 |
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.jdbc.core.JdbcTemplate;
11 | import org.springframework.jdbc.core.RowMapper;
12 |
13 | import jbr.springmvc.model.Login;
14 | import jbr.springmvc.model.User;
15 |
16 | public class UserDaoImpl implements UserDao {
17 |
18 | @Autowired
19 | DataSource datasource;
20 |
21 | @Autowired
22 | JdbcTemplate jdbcTemplate;
23 |
24 | public int register(User user) {
25 | String sql = "insert into users values(?,?,?,?,?,?,?)";
26 |
27 | return jdbcTemplate.update(sql, new Object[] { user.getUsername(), user.getPassword(), user.getFirstname(),
28 | user.getLastname(), user.getEmail(), user.getAddress(), user.getPhone() });
29 | }
30 |
31 | public User validateUser(Login login) {
32 | String sql = "select * from users where username='" + login.getUsername() + "' and password='" + login.getPassword()
33 | + "'";
34 | List users = jdbcTemplate.query(sql, new UserMapper());
35 |
36 | return users.size() > 0 ? users.get(0) : null;
37 | }
38 |
39 | }
40 |
41 | class UserMapper implements RowMapper {
42 |
43 | public User mapRow(ResultSet rs, int arg1) throws SQLException {
44 | User user = new User();
45 |
46 | user.setUsername(rs.getString("username"));
47 | user.setPassword(rs.getString("password"));
48 | user.setFirstname(rs.getString("firstname"));
49 | user.setLastname(rs.getString("lastname"));
50 | user.setEmail(rs.getString("email"));
51 | user.setAddress(rs.getString("address"));
52 | user.setPhone(rs.getInt("phone"));
53 |
54 | return user;
55 | }
56 | }
--------------------------------------------------------------------------------
/springmvc-userlogin/src/main/webapp/jsp/register.jsp:
--------------------------------------------------------------------------------
1 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
2 |
3 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
4 | pageEncoding="ISO-8859-1"%>
5 |
6 |
7 |
8 | Registration
9 |
10 |
11 |
13 |
14 |
15 |
16 | Username
17 |
18 |
19 |
20 | Password
21 |
23 |
24 |
25 | FirstName
26 |
28 |
29 |
30 | LastName
31 |
32 |
33 |
34 | Email
35 |
36 |
37 |
38 | Address
39 |
40 |
41 |
42 | Phone
43 |
44 |
45 |
46 |
47 |
48 | Register
49 |
50 |
51 |
52 |
53 | Home
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/springmvc-jquery/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/springmvc-helloworld/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 | jbr
7 | springmvc-helloworld
8 | war
9 | 0.1
10 | springmvc-helloworld Maven Webapp
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 | 4.3.2.RELEASE
16 | 4.12
17 | 3.1.0
18 | 1.8
19 |
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | ${junit.version}
27 | test
28 |
29 |
30 |
31 |
32 | org.springframework
33 | spring-core
34 | ${spring.version}
35 |
36 |
37 |
38 | org.springframework
39 | spring-beans
40 | ${spring.version}
41 |
42 |
43 |
44 | org.springframework
45 | spring-context
46 | ${spring.version}
47 |
48 |
49 |
50 | org.springframework
51 | spring-jdbc
52 | ${spring.version}
53 |
54 |
55 |
56 | org.springframework
57 | spring-test
58 | ${spring.version}
59 | test
60 |
61 |
62 |
63 | org.springframework
64 | spring-webmvc
65 | ${spring.version}
66 |
67 |
68 |
69 |
70 | javax.servlet
71 | javax.servlet-api
72 | ${servlet.version}
73 |
74 |
75 |
76 | springmvc-helloworld
77 | src/main/java
78 |
79 |
80 | maven-compiler-plugin
81 | 3.5.1
82 |
83 | ${java.version}
84 | ${java.version}
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/springmvc-userlogin/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | jbr
5 | springmvc-user-reg-login
6 | war
7 | 0.1
8 | springmvc-user-reg-login
9 | http://maven.apache.org
10 |
11 |
12 | UTF-8
13 | 5.2.4.RELEASE
14 | 4.12
15 | 3.1.0
16 | 1.8
17 | 8.0.17
18 |
19 |
20 |
21 |
22 |
23 | junit
24 | junit
25 | ${junit.version}
26 | test
27 |
28 |
29 |
30 |
31 | org.springframework
32 | spring-core
33 | ${spring.version}
34 |
35 |
36 |
37 | org.springframework
38 | spring-beans
39 | ${spring.version}
40 |
41 |
42 |
43 | org.springframework
44 | spring-context
45 | ${spring.version}
46 |
47 |
48 |
49 | org.springframework
50 | spring-jdbc
51 | ${spring.version}
52 |
53 |
54 |
55 | org.springframework
56 | spring-test
57 | ${spring.version}
58 | test
59 |
60 |
61 |
62 | org.springframework
63 | spring-webmvc
64 | ${spring.version}
65 |
66 |
67 |
68 |
69 | mysql
70 | mysql-connector-java
71 | ${mysql.connector.version}
72 |
73 |
74 |
75 |
76 | javax.servlet
77 | javax.servlet-api
78 | ${servlet.version}
79 |
80 |
81 |
82 |
83 | springmvc-user-reg-login
84 | src/main/java
85 |
86 |
87 | maven-compiler-plugin
88 | 3.5.1
89 |
90 | ${java.version}
91 | ${java.version}
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/springmvc-gradle/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/springmvc-collections/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/src/main/java/jbr/springmvc/config/AppConfig.java:
--------------------------------------------------------------------------------
1 | package jbr.springmvc.config;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.ComponentScan;
8 | import org.springframework.context.annotation.Configuration;
9 | import org.springframework.http.MediaType;
10 | import org.springframework.oxm.jaxb.Jaxb2Marshaller;
11 | import org.springframework.web.accept.ContentNegotiationManager;
12 | import org.springframework.web.servlet.ViewResolver;
13 | import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
14 | import org.springframework.web.servlet.config.annotation.EnableWebMvc;
15 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
16 | import org.springframework.web.servlet.view.ContentNegotiatingViewResolver;
17 | import org.springframework.web.servlet.view.InternalResourceViewResolver;
18 | import org.springframework.web.servlet.view.JstlView;
19 |
20 | import jbr.springmvc.model.Person;
21 | import jbr.springmvc.view.ExcelViewResolver;
22 | import jbr.springmvc.view.Jaxb2MarshallingXmlViewResolver;
23 | import jbr.springmvc.view.JsonViewResolver;
24 | import jbr.springmvc.view.PdfViewResolver;
25 |
26 | @Configuration
27 | @EnableWebMvc
28 | @ComponentScan(basePackages = { "jbr.springmvc" })
29 | public class AppConfig extends WebMvcConfigurationSupport {
30 |
31 | @Override
32 | public void configureContentNegotiation(ContentNegotiationConfigurer negotiationConfigurer) {
33 | negotiationConfigurer.ignoreAcceptHeader(true).defaultContentType(MediaType.TEXT_HTML);
34 | }
35 |
36 | @Bean
37 | public ViewResolver contentNegotiatingViewResolver(ContentNegotiationManager negotiationManager) {
38 | ContentNegotiatingViewResolver negotiatingViewResolver = new ContentNegotiatingViewResolver();
39 | negotiatingViewResolver.setContentNegotiationManager(negotiationManager);
40 |
41 | List viewResolvers = new ArrayList();
42 |
43 | viewResolvers.add(viewResolver()); // default
44 |
45 | viewResolvers.add(jaxb2MarshallingXmlViewResolver());
46 | viewResolvers.add(jsonViewResolver());
47 | viewResolvers.add(pdfViewResolver());
48 | viewResolvers.add(excelViewResolver());
49 |
50 | negotiatingViewResolver.setViewResolvers(viewResolvers);
51 |
52 | return negotiatingViewResolver;
53 | }
54 |
55 | @Bean
56 | public ViewResolver jaxb2MarshallingXmlViewResolver() {
57 | Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
58 | jaxb2Marshaller.setClassesToBeBound(Person.class);
59 |
60 | return new Jaxb2MarshallingXmlViewResolver(jaxb2Marshaller);
61 | }
62 |
63 | @Bean
64 | public ViewResolver jsonViewResolver() {
65 | return new JsonViewResolver();
66 | }
67 |
68 | @Bean
69 | public ViewResolver pdfViewResolver() {
70 | return new PdfViewResolver();
71 | }
72 |
73 | @Bean
74 | public ViewResolver excelViewResolver() {
75 | return new ExcelViewResolver();
76 | }
77 |
78 | @Bean
79 | public ViewResolver viewResolver() {
80 | InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
81 | viewResolver.setViewClass(JstlView.class);
82 | viewResolver.setPrefix("/WEB-INF/views/");
83 | viewResolver.setSuffix(".jsp");
84 |
85 | return viewResolver;
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ContentNegotiating/pom.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | 4.0.0
6 | jbr.springmvc
7 | springmvc-ViewResolver-ContentNegotiating
8 | war
9 | 0.1
10 | springmvc-ViewResolver-ContentNegotiating Maven Webapp
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 | 1.8
16 | 3.5.1
17 | 2.4
18 | 4.12
19 |
20 | 5.1.0.RELEASE
21 | 5.1.2.Final
22 | 1.1.0.Final
23 |
24 | 1.2.1
25 | 1.1.2
26 | 3.1.0
27 | 2.3.1
28 |
29 | 2.10.2
30 | 4.0.1
31 |
32 |
33 |
34 |
35 | junit
36 | junit
37 | ${junit.version}
38 | test
39 |
40 |
41 |
42 |
43 | org.springframework
44 | spring-core
45 | ${springframework.version}
46 |
47 |
48 | org.springframework
49 | spring-web
50 | ${springframework.version}
51 |
52 |
53 | org.springframework
54 | spring-webmvc
55 | ${springframework.version}
56 |
57 |
58 | org.springframework
59 | spring-oxm
60 | ${springframework.version}
61 |
62 |
63 |
64 |
65 | javax.servlet.jsp.jstl
66 | javax.servlet.jsp.jstl-api
67 | ${jstl.api.version}
68 |
69 |
70 | taglibs
71 | standard
72 | ${taglib.std.version}
73 |
74 |
75 |
76 |
77 | javax.servlet
78 | javax.servlet-api
79 | ${servlet.api.version}
80 | provided
81 |
82 |
83 |
84 |
85 | javax.servlet.jsp
86 | javax.servlet.jsp-api
87 | ${jsp.api.version}
88 | provided
89 |
90 |
91 |
92 |
93 | javax.validation
94 | validation-api
95 | ${javax.validation.version}
96 |
97 |
98 |
99 |
100 | com.fasterxml.jackson.core
101 | jackson-databind
102 | ${jackson.version}
103 |
104 |
105 | com.fasterxml.jackson.core
106 | jackson-core
107 | ${jackson.version}
108 |
109 |
110 | com.fasterxml.jackson.core
111 | jackson-annotations
112 | ${jackson.version}
113 |
114 |
115 |
116 |
117 | com.lowagie
118 | itext
119 | 2.1.7
120 |
121 |
122 |
123 |
124 | org.apache.poi
125 | poi
126 | ${apach.poi.version}
127 |
128 |
129 |
130 | org.apache.poi
131 | poi-ooxml
132 | ${apach.poi.version}
133 |
134 |
135 |
136 |
137 | springmvc-ViewResolver-ContentNegotiating
138 |
139 |
140 | org.apache.maven.plugins
141 | maven-compiler-plugin
142 | ${mvn.compiler.plugin.version}
143 |
144 | ${java.version}
145 | ${java.version}
146 |
147 |
148 |
149 | org.apache.maven.plugins
150 | maven-war-plugin
151 | ${mvn.war.plugin.version}
152 |
153 | src/main/webapp
154 | spring5mvc-view-resolver
155 | false
156 |
157 |
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/springmvc-jquery/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/springmvc-embedded-tomcat/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/springmvc-embedded-jetty/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save ( ) {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-Xml/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/springmvc-viewresolvers-ResourceBundle/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/springmvc-gradle/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin or MSYS, switch paths to Windows format before running java
129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------
/springmvc-collections/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin or MSYS, switch paths to Windows format before running java
129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------