Lab complete?

This commit is contained in:
Imbus 2024-02-14 19:04:14 +01:00
parent 1314e0e2b6
commit db20aa2f53
2 changed files with 2 additions and 1 deletions

View file

@ -56,7 +56,7 @@ public class Database implements AutoCloseable {
}
public boolean addAnswer(String name, String answerOne, String answerTwo, String answerThree, String answerFour) {
String sql = "insert into Answer (answerOne, answerTwo, answerThree, answerFour, name) values(?,?,?,?,?)";
String sql = "insert into Answers (answerOne, answerTwo, answerThree, answerFour, name) values(?,?,?,?,?)";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setString(1, answerOne);

View file

@ -123,6 +123,7 @@ public class Survey extends HttpServlet {
// display the next page
if (valuesOk){
int sum = s11 + s12 + s13 + s14;
db.addAnswer(name, s11String, s12String, s13String, s14String);
// This is only to show that it is possible to do something with the values.
// It is of course meaningless to calculate the sum.
out.println("<p> Hello " + name);