Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
2
20230403
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
20230403
Commits
aa9c6822
Commit
aa9c6822
authored
Apr 25, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spis treści i która godzina w JSP
parent
7db12cd7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
2 deletions
+89
-2
RootController.java
...Spring/src/main/java/sklep/controller/RootController.java
+17
-2
index.jsp
PC30-SklepSpring/src/main/webapp/index.jsp
+54
-0
wyswietl_czas.jsp
PC30-SklepSpring/src/main/webapp/wyswietl_czas.jsp
+18
-0
No files found.
PC30-SklepSpring/src/main/java/sklep/controller/RootController.java
View file @
aa9c6822
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
;
@Controller
public
class
RootController
{
@GetMapping
(
"/"
)
public
String
index
()
{
return
"index.jsp"
;
}
@GetMapping
(
"/hello"
)
@ResponseBody
public
String
root
()
{
public
String
hello
()
{
return
"Hello Spring"
;
}
@GetMapping
(
"/time"
)
public
String
ktoraGodzina
(
Model
model
)
{
LocalDateTime
dt
=
LocalDateTime
.
now
();
model
.
addAttribute
(
"dt"
,
dt
);
return
"wyswietl_czas.jsp"
;
}
}
PC30-SklepSpring/src/main/webapp/index.jsp
0 → 100644
View file @
aa9c6822
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Aplikacja Sklep Spring
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"styl.css"
>
</head>
<body>
<h1>
Spis treści
</h1>
<h2>
Podstawy
</h2>
<ul>
<li><a
href=
"/"
>
Spis treści
</a></li>
<li><a
href=
"/hello"
>
Hello world
</a></li>
<li><a
href=
"/time"
>
Która godzina
</a></li>
</ul>
<h2>
Logowanie
</h2>
<ul>
<li><a
href=
"/login"
>
zaloguj się
</a>
<li><a
href=
"/logout"
>
wyloguj się
</a>
<li><a
href=
"/whoami"
>
sprawdź kim jesteś
</a>
</ul>
<h2>
Katalog produktów
</h2>
<ul>
<li><a
href=
"/products"
>
products
</a>
- wszystkie produkty
</li>
<li><a
href=
"/products/1"
>
products/1
</a>
- jeden produkt
</li>
<li><a
href=
"/products/9"
>
products/9
</a>
- nieistniejący produkt
</li>
<li><a
href=
"/products/szukaj"
>
wyszukiwarka
</a></li>
<li><a
href=
"/products/szukaj?name=pralka"
>
wyszukiwarka/pralka
</a></li>
<li><a
href=
"/products/new"
>
nowy produkt
</a></li>
<li><a
href=
"/products/1/edit"
>
edycja produktu
</a></li>
</ul>
<h2>
Edycja klienta
</h2>
<ul>
<li><a
href=
"/customers"
>
lista klientów
</a>
<li><a
href=
"/customers/new"
>
nowy klient
</a>
<li><a
href=
"/customers/ala@example.com/edit"
>
edycja klienta
</a>
</ul>
<h2>
Alternatywne dostępy do bazy danych
</h2>
<ul>
<li><a
href=
"/alt1/products"
>
Dostęp JDBC
</a>
(klasyczne getConnection)
</li>
<li><a
href=
"/alt1/products/1"
>
jeden produkt
</a></li>
<li><a
href=
"/alt1/products/szukaj?name=pralka"
>
wg nazwy
</a></li>
<li><a
href=
"/alt2/products"
>
Dostęp JDBC
</a>
(wstrzykiwanie DataSource)
</li>
<li><a
href=
"/alt2/products/1"
>
jeden produkt
</a></li>
<li><a
href=
"/alt2/products/szukaj?name=pralka"
>
wg nazwy
</a></li>
</ul>
</body>
</html>
PC30-SklepSpring/src/main/webapp/wyswietl_czas.jsp
0 → 100644
View file @
aa9c6822
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Która godzina
</title>
</head>
<body>
<h1>
Która godzina
</h1>
<div>
Bieżący czas: ${dt}
</div>
<div>
${dt.hour}:${dt.minute}:${dt.second}
</div>
<p>
Test obliczeń: ${2 * 3 + 4}
</p>
</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