Skip to content
Snippets Groups Projects
Commit 935c6d70 authored by Charlie Darques's avatar Charlie Darques
Browse files

modifications constructeur message

parent 79ae2338
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
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 LocalDate 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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment