Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230928
Overview
Overview
Details
Activity
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
Patryk Czarnik
javab_20230928
Commits
89857245
Commit
89857245
authored
Oct 20, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Obsługa JSP
parent
2a812946
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
0 deletions
+32
-0
pom.xml
PC30-SklepSpring/pom.xml
+10
-0
RootController.java
...Spring/src/main/java/sklep/controller/RootController.java
+10
-0
pokaz_czas.jsp
PC30-SklepSpring/src/main/webapp/pokaz_czas.jsp
+12
-0
No files found.
PC30-SklepSpring/pom.xml
View file @
89857245
...
...
@@ -55,6 +55,16 @@
<artifactId>
spring-security-test
</artifactId>
<scope>
test
</scope>
</dependency>
<!-- dopisane zależności, aby działało JSP -->
<dependency>
<groupId>
org.apache.tomcat.embed
</groupId>
<artifactId>
tomcat-embed-jasper
</artifactId>
</dependency>
<dependency>
<groupId>
jakarta.servlet.jsp.jstl
</groupId>
<artifactId>
jakarta.servlet.jsp.jstl-api
</artifactId>
</dependency>
</dependencies>
<build>
...
...
PC30-SklepSpring/src/main/java/sklep/controller/RootController.java
View file @
89857245
package
sklep
.
controller
;
import
java.time.LocalDateTime
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -13,4 +16,11 @@ public class RootController {
return
"Hello world"
;
}
@GetMapping
(
"/time"
)
public
String
ktoraGodzina
(
Model
model
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
model
.
addAttribute
(
"dt"
,
now
);
return
"pokaz_czas.jsp"
;
}
}
PC30-SklepSpring/src/main/webapp/pokaz_czas.jsp
0 → 100644
View file @
89857245
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Pokaż czas
</title>
</head>
<body>
<div>
Bieżący czas:
<strong>
${dt}
</strong></div>
</body>
</html>
\ No newline at end of file
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