Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
S4a021 Web Backend
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
Charlie Darques
S4a021 Web Backend
Commits
ba3d095a
Commit
ba3d095a
authored
1 month ago
by
Charlie Darques
Browse files
Options
Downloads
Patches
Plain Diff
correction bug page following
parent
4ae5a163
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
WEB-INF/src/controleurs/Following.java
+19
-12
19 additions, 12 deletions
WEB-INF/src/controleurs/Following.java
with
19 additions
and
12 deletions
WEB-INF/src/controleurs/Following.java
+
19
−
12
View file @
ba3d095a
...
...
@@ -11,7 +11,7 @@ import jakarta.servlet.annotation.WebServlet;
import
jakarta.servlet.http.HttpServlet
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
dao.ThreadDAO
;
import
dao.UserDAO
;
import
dto.MyThread
;
import
dto.User
;
...
...
@@ -23,19 +23,19 @@ public class Following extends HttpServlet {
if
(
req
.
getSession
().
getAttribute
(
"user"
)
!=
null
)
{
PrintWriter
out
=
res
.
getWriter
();
UserDAO
userDAO
=
new
UserDAO
();
ThreadDAO
threadDao
=
new
ThreadDAO
();
String
login
=
(
String
)
req
.
getSession
().
getAttribute
(
"login"
);
User
user
=
(
User
)
req
.
getSession
().
getAttribute
(
"user"
);
if
(!
userDAO
.
isDatabased
(
user
))
res
.
sendRedirect
(
"http://localhost:8080/s4a021-web-backend/index.html"
);
List
<
MyThread
>
threadsFollowedByUser
=
null
;
// try {
// threadsFollowedByUser = userDAO.getThreadsFollowedByUser(user);
// }
// catch (SQLException sqle) {
// sqle.getStackTrace();
// }
// TODO : à décommenter
List
<
Integer
>
threadsFollowedByUser
=
null
;
try
{
threadsFollowedByUser
=
userDAO
.
getThreadsFollowedByUser
(
user
);
}
catch
(
SQLException
sqle
)
{
sqle
.
getStackTrace
();
}
System
.
out
.
println
(
threadsFollowedByUser
.
size
());
...
...
@@ -53,17 +53,24 @@ public class Following extends HttpServlet {
out
.
println
(
"<h1>Threads followed</h1>"
);
if
(!
threadsFollowedByUser
.
isEmpty
())
{
for
(
MyThread
t
:
threadsFollowedByUser
)
{
for
(
Integer
t
:
threadsFollowedByUser
)
{
MyThread
thread
=
null
;
try
{
thread
=
threadDao
.
getThreadById
(
t
);
}
catch
(
SQLException
sqle
)
{
sqle
.
getStackTrace
();
}
LocalDate
followDate
=
null
;
try
{
followDate
=
userDAO
.
getFollowDateOfThread
(
user
,
t
);
followDate
=
userDAO
.
getFollowDateOfThread
(
user
,
t
hread
);
}
catch
(
SQLException
sqle
)
{
sqle
.
getStackTrace
();
}
out
.
println
(
"<div class=\"thread\">"
);
out
.
println
(
"<h3 class=\"threadname\">Thread name: "
+
t
.
getThreadName
()
+
"</h3>"
);
out
.
println
(
"<h3 class=\"threadname\">Thread name: "
+
t
hread
.
getThreadName
()
+
"</h3>"
);
out
.
println
(
"<p class=\"followDate\">Following since: "
+
followDate
+
"</p>"
);
out
.
println
(
"</div>"
);
}
...
...
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