Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_java2b_20250412
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
alx_java2b_20250412
Commits
b2ca1f5a
Commit
b2ca1f5a
authored
May 31, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefix i suffix
parent
0ddcd023
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
ProductController.java
...ing/src/main/java/sklep/controller/ProductController.java
+3
-3
RootController.java
...Spring/src/main/java/sklep/controller/RootController.java
+1
-1
application.properties
PC37-SklepSpring/src/main/resources/application.properties
+3
-2
No files found.
PC37-SklepSpring/src/main/java/sklep/controller/ProductController.java
View file @
b2ca1f5a
...
...
@@ -22,7 +22,7 @@ public class ProductController {
public
String
getProducts
(
Model
model
)
{
List
<
Product
>
products
=
productRepository
.
findAll
();
model
.
addAttribute
(
"products"
,
products
);
return
"
/WEB-INF/templates/products.jsp
"
;
return
"
products
"
;
}
@GetMapping
(
path
=
"/products/{id}"
,
produces
=
"text/html"
)
...
...
@@ -30,9 +30,9 @@ public class ProductController {
Optional
<
Product
>
optProduct
=
productRepository
.
findById
(
id
);
if
(
optProduct
.
isPresent
())
{
model
.
addAttribute
(
"product"
,
optProduct
.
get
());
return
"
/WEB-INF/templates/product.jsp
"
;
return
"
product
"
;
}
else
{
return
"
/WEB-INF/templates/missing_product.jsp
"
;
return
"
missing_product
"
;
}
}
...
...
PC37-SklepSpring/src/main/java/sklep/controller/RootController.java
View file @
b2ca1f5a
...
...
@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
public
class
RootController
{
@GetMapping
(
"/"
)
public
String
index
()
{
return
"
/WEB-INF/templates/spis_tresci.jsp
"
;
return
"
spis_tresci
"
;
}
@GetMapping
(
"/hello"
)
...
...
PC37-SklepSpring/src/main/resources/application.properties
View file @
b2ca1f5a
spring.application.name
=
PC37-SklepSpring
spring.mvc.view.prefix
=
/WEB-INF/templates/
spring.mvc.view.suffix
=
.jsp
spring.datasource.url
=
jdbc:postgresql://localhost/sklep
spring.datasource.username
=
alx
spring.datasource.password
=
abc123
\ No newline at end of file
spring.datasource.password
=
abc123
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