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

corrections

parent 57f34c13
No related branches found
No related tags found
No related merge requests found
...@@ -47,10 +47,13 @@ public class Discover extends HttpServlet { ...@@ -47,10 +47,13 @@ public class Discover extends HttpServlet {
} catch (SQLException e) { } catch (SQLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
User sender = userDao.getUserById(message.getSenderId());
String senderName = sender.getUserName();
out.println("<div class=\"message\">"); out.println("<div class=\"message\">");
out.println("<h3 class=\"msgThread\">" + msgThread.getThreadName() + "</h3>"); out.println("<h3 class=\"msgThread\">" + msgThread.getThreadName() + "</h3>");
out.println("<p class=\"msgContent\">" + message.getContent() + "</p>"); out.println("<p class=\"msgContent\">" + message.getContent() + "</p>");
out.println("<p class=\"sender\">by " + userDao.getUserById(message.getSenderId()).getUserName() + "</p>"); out.println("<p class=\"sender\">by " + senderName + "</p>");
out.println("<form class=\"followThread\" action=\"http://localhost:8080/s4a021-web-backend/FollowThread\" method=\"post\">"); out.println("<form class=\"followThread\" action=\"http://localhost:8080/s4a021-web-backend/FollowThread\" method=\"post\">");
out.println("<input name=\"threadid\" type=\"hidden\" value=\"" + msgThread.getId() +"\">"); out.println("<input name=\"threadid\" type=\"hidden\" value=\"" + msgThread.getId() +"\">");
......
...@@ -81,7 +81,7 @@ public class Feed extends HttpServlet { ...@@ -81,7 +81,7 @@ public class Feed extends HttpServlet {
} }
out.println("<div class=\"discover\">"); out.println("<div class=\"discover\">");
out.println("<a href=\"\">Discover new threads</a>"); out.println("<a href=\"http://localhost:8080/s4a021-web-backend/Discover\">Discover new threads</a>");
out.println("<a href=\"http://localhost:8080/s4a021-web-backend/NewThread\">Create a new thread</a>"); out.println("<a href=\"http://localhost:8080/s4a021-web-backend/NewThread\">Create a new thread</a>");
out.println("</div>"); out.println("</div>");
......
...@@ -62,7 +62,7 @@ public class Following extends HttpServlet { ...@@ -62,7 +62,7 @@ public class Following extends HttpServlet {
out.println("<div class=\"thread\">"); out.println("<div class=\"thread\">");
out.println("<h3 class=\"threadname\">Thread name: " + t.getThreadName() + "</h3>"); out.println("<h3 class=\"threadname\">Thread name: " + t.getThreadName() + "</h3>");
out.println("<h4 class=\"followDate\">Following since: " + followDate + "</h4>"); out.println("<p class=\"followDate\">Following since: " + followDate + "</p>");
out.println("</div>"); out.println("</div>");
} }
} }
......
...@@ -63,7 +63,7 @@ public class NewThread extends HttpServlet { ...@@ -63,7 +63,7 @@ public class NewThread extends HttpServlet {
out.println("<h3>Create a new thread</h3>"); out.println("<h3>Create a new thread</h3>");
out.println("<form action=\"http://localhost:8080/s4a021-web-backend/NewThread\" method=\"post\">"); out.println("<form action=\"http://localhost:8080/s4a021-web-backend/NewThread\" method=\"post\">");
out.println("<input name=\"threadname\" type=\"text\" placeholder=\"Name of new thread\">"); out.println("<input name=\"threadname\" type=\"text\" placeholder=\"Name of new thread\">");
out.println("<textarea name=\"first_message\" type=\"text\" rows=\"2\" cols=\"30\" placeholder=\"Post the first message of your new thread!\">"); out.println("<textarea name=\"first_message\" type=\"text\" rows=\"2\" cols=\"30\" placeholder=\"Post the first message of your new thread!\"></textarea>");
out.println("<button type=\"submit\">Create</button>"); out.println("<button type=\"submit\">Create</button>");
out.println("</form>"); out.println("</form>");
......
...@@ -100,7 +100,7 @@ public class UserDAO { ...@@ -100,7 +100,7 @@ public class UserDAO {
User user = new User(0,null,null); User user = new User(0,null,null);
try{ try{
PreparedStatement stmt = this.con.prepareStatement("SELECT * FROM userAccount WHERE id=?"); PreparedStatement stmt = this.con.prepareStatement("SELECT * FROM userAccount WHERE userid=?");
stmt.setInt(1, id); stmt.setInt(1, id);
ResultSet rs = stmt.executeQuery(); ResultSet rs = stmt.executeQuery();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment