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
935c6d70
Commit
935c6d70
authored
2 months ago
by
Charlie Darques
Browse files
Options
Downloads
Patches
Plain Diff
modifications constructeur message
parent
79ae2338
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/dao/UserDAO.java
+2
-3
2 additions, 3 deletions
WEB-INF/src/dao/UserDAO.java
WEB-INF/src/dto/Message.java
+9
-3
9 additions, 3 deletions
WEB-INF/src/dto/Message.java
with
11 additions
and
6 deletions
WEB-INF/src/dao/UserDAO.java
+
2
−
3
View file @
935c6d70
...
...
@@ -8,9 +8,8 @@ import java.util.List;
import
dto.Message
;
import
dto.MyThread
;
import
dto.User
;
import
jakarta.servlet.http.*
;
public
class
UserDAO
extends
HttpServlet
{
public
class
UserDAO
{
private
Connection
con
;
public
UserDAO
(){
...
...
@@ -221,7 +220,7 @@ public class UserDAO extends HttpServlet{
int
threadID
=
rs
.
getInt
(
3
);
String
content
=
rs
.
getString
(
4
);
Date
creationDate
=
rs
.
getDate
(
5
);
messages
.
add
(
new
Message
(
msgID
,
sender
,
threadID
,
content
,
creationDate
));
messages
.
add
(
new
Message
(
msgID
,
sender
,
threadID
,
content
,
creationDate
.
toLocalDate
()
));
}
}
catch
(
SQLException
sqle
)
{
...
...
This diff is collapsed.
Click to expand it.
WEB-INF/src/dto/Message.java
+
9
−
3
View file @
935c6d70
package
dto
;
import
java.time.LocalDate
;
import
java.util.Date
;
public
class
Message
{
...
...
@@ -7,17 +8,22 @@ public class Message {
private
int
senderId
;
private
int
threadId
;
private
String
content
;
private
Date
creationDate
;
private
Local
Date
creationDate
;
// Constructor //
public
Message
(
int
msgId
,
int
senderId
,
int
threadId
,
String
content
,
Date
creationDate
)
{
public
Message
(
int
msgId
,
int
senderId
,
int
threadId
,
String
content
)
{
this
.
msgId
=
msgId
;
this
.
senderId
=
senderId
;
this
.
threadId
=
threadId
;
this
.
content
=
content
;
this
.
creationDate
=
creationDate
;
this
.
creationDate
=
LocalDate
.
now
();
}
public
Message
(
int
msgId
,
int
senderId
,
int
threadId
,
String
content
,
LocalDate
date
)
{
this
(
msgId
,
senderId
,
threadId
,
content
);
this
.
creationDate
=
date
;
}
...
...
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