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
f2e97ea4
Commit
f2e97ea4
authored
Oct 18, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
product3.jsp
parent
45bdfe9d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
products3.jsp
PC25-SklepWeb/src/main/webapp/products3.jsp
+42
-0
No files found.
PC25-SklepWeb/src/main/webapp/products3.jsp
0 → 100644
View file @
f2e97ea4
<
%@
page
import=
"sklep.model.Product"
%
>
<
%@
page
import=
"java.util.List"
%
>
<
%@
page
import=
"sklep.db.ProductDAO"
%
>
<
%@
page
import=
"sklep.db.DBConnection"
%
>
<
%@
page
language=
"java"
contentType=
"text/html; charset=UTF-8"
pageEncoding=
"UTF-8"
%
>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Lista produktów 3
</title>
</head>
<body>
<h1>
Lista produktów - wersja 3 JSP
</h1>
<p>
W tej wersji wewnątrz skryptu JSP umieścimy fragmenty Javy, tzw. scriptlets.
To jest pierwsza techniczna możliwość, którą oferował standard JSP.
</p>
<p>
Uwaga - ta wersja nadal jest nieporządna i
<strong>
nie jest
</strong>
wzorem do naśladowania.
Mieszanie kodu HTML z Javą w taki sposób, szczególnie jak zrobiliśmy z pętlą pod koniec, jest w bardzo złym stylu.
</p>
<p>
[
<a
href=
"index.html"
>
powrót do spisu treści
</a>
]
</p>
<
%
--
Poni
ż
ej
skryptlet
,
kt
ó
ry
otwiera
po
łą
czenie
z
baz
ą
danych:
--
%
>
<
%
DBConnection
db =
DBConnection.open();
ProductDAO
dao =
db.productDAO();
%
>
<p>
Pobieranie danych...
</p>
<
%
List
<
Product
>
products = dao.readAll();
%>
<p>
Pobrano
<
%=
products
.
size
()
%
>
produktów.
</p>
<h3>
Wszystkie produkty
</h3>
<ul>
<
%
for
(
Product
product
:
products
)
{
%
>
<li><
%=
product
.
getProductName
()
%
>
za
<
%=
product
.
getPrice
()
%
></li>
<
%
}
%
>
</ul>
<
%
db
.
close
();
%
>
<p>
[
<a
href=
"index.html"
>
powrót do spisu treści
</a>
]
</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