Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d9e326a3
Commit
d9e326a3
authored
Dec 19, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add @Value injection to JSP (WAR) sample
parent
b6945564
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
0 deletions
+8
-0
WelcomeController.java
...rg/springframework/boot/sample/jsp/WelcomeController.java
+5
-0
application.properties
...-sample-web-jsp/src/main/resources/application.properties
+1
-0
welcome.jsp
...ot-sample-web-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp
+2
-0
No files found.
spring-boot-samples/spring-boot-sample-web-jsp/src/main/java/org/springframework/boot/sample/jsp/WelcomeController.java
View file @
d9e326a3
...
@@ -3,15 +3,20 @@ package org.springframework.boot.sample.jsp;
...
@@ -3,15 +3,20 @@ package org.springframework.boot.sample.jsp;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
@Controller
@Controller
public
class
WelcomeController
{
public
class
WelcomeController
{
@Value
(
"${application.message:Hello World}"
)
private
String
message
=
"Hello World"
;
@RequestMapping
(
"/"
)
@RequestMapping
(
"/"
)
public
String
welcome
(
Map
<
String
,
Object
>
model
)
{
public
String
welcome
(
Map
<
String
,
Object
>
model
)
{
model
.
put
(
"time"
,
new
Date
());
model
.
put
(
"time"
,
new
Date
());
model
.
put
(
"message"
,
message
);
return
"welcome"
;
return
"welcome"
;
}
}
...
...
spring-boot-samples/spring-boot-sample-web-jsp/src/main/resources/application.properties
View file @
d9e326a3
spring.view.prefix
:
/WEB-INF/jsp/
spring.view.prefix
:
/WEB-INF/jsp/
spring.view.suffix
:
.jsp
spring.view.suffix
:
.jsp
application.message
:
Hello Phil
\ No newline at end of file
spring-boot-samples/spring-boot-sample-web-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp
View file @
d9e326a3
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
Spring URL: ${springUrl} at ${time}
Spring URL: ${springUrl} at ${time}
<br>
<br>
JSTL URL: ${url}
JSTL URL: ${url}
<br>
Message: ${message}
</body>
</body>
</html>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment