Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SAE4.A02.1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxime Gosselin
SAE4.A02.1
Commits
b7f611fa
Commit
b7f611fa
authored
2 months ago
by
Florine Lefebvre
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'refs/remotes/origin/main'
parents
028e3029
bda85e30
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
WEB-INF/src/modele/dao/DaoThread.java
+16
-0
16 additions, 0 deletions
WEB-INF/src/modele/dao/DaoThread.java
WEB-INF/vue/fils.jsp
+8
-2
8 additions, 2 deletions
WEB-INF/vue/fils.jsp
with
24 additions
and
2 deletions
WEB-INF/src/modele/dao/DaoThread.java
+
16
−
0
View file @
b7f611fa
...
...
@@ -81,4 +81,20 @@ public class DaoThread {
}
return
res
;
}
public
List
<
Thread
>
findThreadNotFollow
(
String
creator
)
{
DS
bdd
=
DS
.
getInstance
();
List
<
Thread
>
res
=
new
ArrayList
<>();
try
(
Connection
con
=
bdd
.
getConnection
())
{
PreparedStatement
ps
=
con
.
prepareStatement
(
"SELECT * FROM threads WHERE id_thread NOT IN (SELECT id_thread FROM followers WHERE username = ?)"
);
ps
.
setString
(
1
,
creator
);
ResultSet
rs
=
ps
.
executeQuery
();
while
(
rs
.
next
())
{
res
.
add
(
new
Thread
(
rs
.
getInt
(
"id_thread"
),
rs
.
getString
(
"creator"
),
rs
.
getString
(
"name"
),
rs
.
getDate
(
"date"
).
toLocalDate
()));
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
res
;
}
}
This diff is collapsed.
Click to expand it.
WEB-INF/vue/fils.jsp
+
8
−
2
View file @
b7f611fa
<%@ page
contentType=
"text/html; charset=UTF-8"
%>
<%@ page
import=
"modele.dao.DaoThread"
%>
<%@ page
import=
"modele.dto.Thread"
%>
<%@ page
import=
"modele.dao.DaoUser"
%>
<%@ page
import=
"modele.dto.User"
%>
<%
// vérification de l'authentification
if
(
request
.
getSession
().
getAttribute
(
"username"
)
==
null
)
response
.
sendRedirect
(
"index.html"
);
...
...
@@ -8,6 +10,7 @@
<%!
DaoThread
daoThread
=
new
DaoThread
();
DaoUser
daoUser
=
new
DaoUser
();
%>
<!DOCTYPE html>
...
...
@@ -60,8 +63,11 @@
<h1>
Liste des fils !
</h1>
<hr
/>
<%
for
(
Thread
fil
:
daoThread
.
findAll
())
{
%>
<%
System
.
out
.
println
((
String
)
request
.
getSession
().
getAttribute
(
"username"
));
User
user
=
daoUser
.
findByUsername
((
String
)
request
.
getSession
().
getAttribute
(
"username"
));
%>
<%
for
(
Thread
fil
:
daoThread
.
findThreadNotFollow
(
user
.
getUsername
()))
{
%>
<div
class=
"p-2 border border-primary border-3 rounded mb-3"
>
<div
class=
"d-flex justify-content-between"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment