Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20240528-BJava
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
20240528-BJava
Commits
9258a181
Commit
9258a181
authored
Jun 27, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dodanie obsługi JSP
parent
e9377d0f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
pom.xml
PC33-SklepSpring/pom.xml
+14
-0
RootController.java
...Spring/src/main/java/sklep/controller/RootController.java
+9
-0
wyswietl_czas.jsp
PC33-SklepSpring/src/main/webapp/wyswietl_czas.jsp
+10
-0
No files found.
PC33-SklepSpring/pom.xml
View file @
9258a181
...
...
@@ -68,6 +68,20 @@
<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>
<dependency>
<groupId>
org.glassfish.web
</groupId>
<artifactId>
jakarta.servlet.jsp.jstl
</artifactId>
</dependency>
</dependencies>
<build>
...
...
PC33-SklepSpring/src/main/java/sklep/controller/RootController.java
View file @
9258a181
package
sklep
.
controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.time.LocalDateTime
;
@Controller
public
class
RootController
{
...
...
@@ -12,4 +15,10 @@ public class RootController {
public
String
hello
()
{
return
"Hello world"
;
}
@GetMapping
(
"/czas"
)
public
String
odczytajCzasJsp
(
Model
model
)
{
model
.
addAttribute
(
"dt"
,
LocalDateTime
.
now
());
return
"wyswietl_czas.jsp"
;
}
}
PC33-SklepSpring/src/main/webapp/wyswietl_czas.jsp
0 → 100644
View file @
9258a181
<
%@
page
contentType=
"text/html;charset=UTF-8"
language=
"java"
%
>
<html>
<head>
<title>
Która godzina
</title>
</head>
<body>
<h1>
Wyświetlanie czasu
</h1>
<p>
Teraz jest:
<strong>
${dt}
</strong></p>
</body>
</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