Skip to content

Commit a2637b9

Browse files
committed
first commit
0 parents  commit a2637b9

File tree

8 files changed

+235
-0
lines changed

8 files changed

+235
-0
lines changed

.classpath

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
4+
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
5+
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java|**/application*.yml|**/application*.properties"/>
6+
<classpathentry kind="output" path="target/classes"/>
7+
<classpathentry kind="var" path="M2_REPO/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar" sourcepath="M2_REPO/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final-sources.jar"/>
8+
<classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.2/jstl-1.2.jar" sourcepath="M2_REPO/javax/servlet/jstl/1.2/jstl-1.2-sources.jar"/>
9+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
10+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-web/1.4.2.RELEASE/spring-boot-starter-web-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot-starter-web/1.4.2.RELEASE/spring-boot-starter-web-1.4.2.RELEASE-sources.jar"/>
11+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter/1.4.2.RELEASE/spring-boot-starter-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot-starter/1.4.2.RELEASE/spring-boot-starter-1.4.2.RELEASE-sources.jar"/>
12+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot/1.4.2.RELEASE/spring-boot-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot/1.4.2.RELEASE/spring-boot-1.4.2.RELEASE-sources.jar"/>
13+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/4.3.4.RELEASE/spring-core-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-core/4.3.4.RELEASE/spring-core-4.3.4.RELEASE-sources.jar"/>
14+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/4.3.4.RELEASE/spring-context-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context/4.3.4.RELEASE/spring-context-4.3.4.RELEASE-sources.jar"/>
15+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/4.3.4.RELEASE/spring-aop-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aop/4.3.4.RELEASE/spring-aop-4.3.4.RELEASE-sources.jar"/>
16+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/4.3.4.RELEASE/spring-beans-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-beans/4.3.4.RELEASE/spring-beans-4.3.4.RELEASE-sources.jar"/>
17+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/4.3.4.RELEASE/spring-expression-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-expression/4.3.4.RELEASE/spring-expression-4.3.4.RELEASE-sources.jar"/>
18+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.4.2.RELEASE/spring-boot-autoconfigure-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.4.2.RELEASE/spring-boot-autoconfigure-1.4.2.RELEASE-sources.jar"/>
19+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-logging/1.4.2.RELEASE/spring-boot-starter-logging-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot-starter-logging/1.4.2.RELEASE/spring-boot-starter-logging-1.4.2.RELEASE-sources.jar"/>
20+
<classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar" sourcepath="M2_REPO/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7-sources.jar"/>
21+
<classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar" sourcepath="M2_REPO/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7-sources.jar"/>
22+
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-sources.jar"/>
23+
<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21-sources.jar"/>
24+
<classpathentry kind="var" path="M2_REPO/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21.jar" sourcepath="M2_REPO/org/slf4j/jul-to-slf4j/1.7.21/jul-to-slf4j-1.7.21-sources.jar"/>
25+
<classpathentry kind="var" path="M2_REPO/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21.jar" sourcepath="M2_REPO/org/slf4j/log4j-over-slf4j/1.7.21/log4j-over-slf4j-1.7.21-sources.jar"/>
26+
<classpathentry kind="var" path="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar" sourcepath="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17-sources.jar"/>
27+
<classpathentry kind="var" path="M2_REPO/org/springframework/boot/spring-boot-starter-tomcat/1.4.2.RELEASE/spring-boot-starter-tomcat-1.4.2.RELEASE.jar" sourcepath="M2_REPO/org/springframework/boot/spring-boot-starter-tomcat/1.4.2.RELEASE/spring-boot-starter-tomcat-1.4.2.RELEASE-sources.jar"/>
28+
<classpathentry kind="var" path="M2_REPO/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6.jar" sourcepath="M2_REPO/org/apache/tomcat/embed/tomcat-embed-core/8.5.6/tomcat-embed-core-8.5.6-sources.jar"/>
29+
<classpathentry kind="var" path="M2_REPO/org/apache/tomcat/embed/tomcat-embed-el/8.5.6/tomcat-embed-el-8.5.6.jar" sourcepath="M2_REPO/org/apache/tomcat/embed/tomcat-embed-el/8.5.6/tomcat-embed-el-8.5.6-sources.jar"/>
30+
<classpathentry kind="var" path="M2_REPO/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.6/tomcat-embed-websocket-8.5.6.jar" sourcepath="M2_REPO/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.6/tomcat-embed-websocket-8.5.6-sources.jar"/>
31+
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar" sourcepath="M2_REPO/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final-sources.jar"/>
32+
<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging/3.3.0.Final/jboss-logging-3.3.0.Final-sources.jar"/>
33+
<classpathentry kind="var" path="M2_REPO/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar" sourcepath="M2_REPO/com/fasterxml/classmate/1.3.3/classmate-1.3.3-sources.jar"/>
34+
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.8.4/jackson-databind-2.8.4.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.8.4/jackson-databind-2.8.4-sources.jar"/>
35+
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.8.4/jackson-annotations-2.8.4.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.8.4/jackson-annotations-2.8.4-sources.jar"/>
36+
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.8.4/jackson-core-2.8.4.jar" sourcepath="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.8.4/jackson-core-2.8.4-sources.jar"/>
37+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/4.3.4.RELEASE/spring-web-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-web/4.3.4.RELEASE/spring-web-4.3.4.RELEASE-sources.jar"/>
38+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/4.3.4.RELEASE/spring-webmvc-4.3.4.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-webmvc/4.3.4.RELEASE/spring-webmvc-4.3.4.RELEASE-sources.jar"/>
39+
<classpathentry kind="var" path="M2_REPO/org/apache/tomcat/embed/tomcat-embed-jasper/8.5.6/tomcat-embed-jasper-8.5.6.jar" sourcepath="M2_REPO/org/apache/tomcat/embed/tomcat-embed-jasper/8.5.6/tomcat-embed-jasper-8.5.6-sources.jar"/>
40+
<classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar" sourcepath="M2_REPO/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1-sources.jar"/>
41+
<classpathentry kind="var" path="M2_REPO/org/webjars/bootstrap/3.3.7/bootstrap-3.3.7.jar"/>
42+
<classpathentry kind="var" path="M2_REPO/org/webjars/jquery/1.11.1/jquery-1.11.1.jar"/>
43+
</classpath>

.project

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>spring-boot-web-jsp</name>
4+
<comment>Spring Boot Web JSP Example. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
5+
<projects/>
6+
<buildSpec>
7+
<buildCommand>
8+
<name>org.eclipse.jdt.core.javabuilder</name>
9+
</buildCommand>
10+
</buildSpec>
11+
<natures>
12+
<nature>org.eclipse.jdt.core.javanature</nature>
13+
</natures>
14+
</projectDescription>

pom.xml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<artifactId>spring-boot-web-jsp</artifactId>
7+
<packaging>war</packaging>
8+
<name>Spring Boot Web JSP Example</name>
9+
<description>Spring Boot Web JSP Example</description>
10+
<url>https://www.mkyong.com</url>
11+
<version>1.0</version>
12+
13+
<parent>
14+
<groupId>org.springframework.boot</groupId>
15+
<artifactId>spring-boot-starter-parent</artifactId>
16+
<version>1.4.2.RELEASE</version>
17+
</parent>
18+
19+
<properties>
20+
<java.version>1.8</java.version>
21+
</properties>
22+
23+
<dependencies>
24+
25+
<!-- Web -->
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-web</artifactId>
29+
</dependency>
30+
31+
<!-- Web with Tomcat + Embed -->
32+
<dependency>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-starter-tomcat</artifactId>
35+
<scope>provided</scope>
36+
</dependency>
37+
38+
<!-- JSTL -->
39+
<dependency>
40+
<groupId>javax.servlet</groupId>
41+
<artifactId>jstl</artifactId>
42+
</dependency>
43+
44+
<!-- Need this to compile JSP -->
45+
<dependency>
46+
<groupId>org.apache.tomcat.embed</groupId>
47+
<artifactId>tomcat-embed-jasper</artifactId>
48+
<scope>provided</scope>
49+
</dependency>
50+
51+
<!-- Need this to compile JSP -->
52+
<dependency>
53+
<groupId>org.eclipse.jdt.core.compiler</groupId>
54+
<artifactId>ecj</artifactId>
55+
<version>4.6.1</version>
56+
<scope>provided</scope>
57+
</dependency>
58+
59+
<!-- Optional, for bootstrap -->
60+
<dependency>
61+
<groupId>org.webjars</groupId>
62+
<artifactId>bootstrap</artifactId>
63+
<version>3.3.7</version>
64+
</dependency>
65+
66+
</dependencies>
67+
<build>
68+
<plugins>
69+
<!-- Package as an executable jar/war -->
70+
<plugin>
71+
<groupId>org.springframework.boot</groupId>
72+
<artifactId>spring-boot-maven-plugin</artifactId>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.mkyong;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.builder.SpringApplicationBuilder;
6+
import org.springframework.boot.web.support.SpringBootServletInitializer;
7+
8+
@SpringBootApplication
9+
public class SpringBootWebApplication extends SpringBootServletInitializer {
10+
11+
@Override
12+
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
13+
return application.sources(SpringBootWebApplication.class);
14+
}
15+
16+
public static void main(String[] args) throws Exception {
17+
SpringApplication.run(SpringBootWebApplication.class, args);
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.mkyong;
2+
3+
import java.util.Map;
4+
5+
import org.springframework.beans.factory.annotation.Value;
6+
import org.springframework.stereotype.Controller;
7+
import org.springframework.web.bind.annotation.RequestMapping;
8+
9+
@Controller
10+
public class WelcomeController {
11+
12+
// inject via application.properties
13+
@Value("${welcome.message:test}")
14+
private String message = "Hello World";
15+
16+
@RequestMapping("/")
17+
public String welcome(Map<String, Object> model) {
18+
model.put("message", this.message);
19+
return "welcome";
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
spring.mvc.view.prefix: /WEB-INF/jsp/
2+
spring.mvc.view.suffix: .jsp
3+
4+
welcome.message: Hello Mkyong
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
h1{
2+
color:#0000FF;
3+
}
4+
5+
h2{
6+
color:#FF0000;
7+
}
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
3+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
4+
<html lang="en">
5+
<head>
6+
7+
<link rel="stylesheet" type="text/css"
8+
href="webjars/bootstrap/3.3.7/css/bootstrap.min.css" />
9+
10+
<!--
11+
<spring:url value="/css/main.css" var="springCss" />
12+
<link href="${springCss}" rel="stylesheet" />
13+
-->
14+
<c:url value="/css/main.css" var="jstlCss" />
15+
<link href="${jstlCss}" rel="stylesheet" />
16+
17+
</head>
18+
<body>
19+
20+
<nav class="navbar navbar-inverse">
21+
<div class="container">
22+
<div class="navbar-header">
23+
<a class="navbar-brand" href="#">Spring Boot</a>
24+
</div>
25+
<div id="navbar" class="collapse navbar-collapse">
26+
<ul class="nav navbar-nav">
27+
<li class="active"><a href="#">Home</a></li>
28+
<li><a href="#about">About</a></li>
29+
</ul>
30+
</div>
31+
</div>
32+
</nav>
33+
34+
<div class="container">
35+
36+
<div class="starter-template">
37+
<h1>Spring Boot Web JSP Example</h1>
38+
<h2>Message: ${message}</h2>
39+
</div>
40+
41+
</div>
42+
<!-- /.container -->
43+
44+
<script type="text/javascript"
45+
src="webjars/bootstrap/3.3.7/js/bootstrap.min.js"></script>
46+
47+
</body>
48+
49+
</html>

0 commit comments

Comments
 (0)