From 49287ee2e4a0140466acf8ec0a0a83d5aef5834d Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 8 Apr 2019 18:30:46 +0200 Subject: [PATCH] ~ moved HelloWorld Servlet ~ asserted connection to database Signed-off-by: Johannes Theiner --- src/main/java/de/hsel/itech/db/Database.java | 2 +- src/main/java/de/hsel/itech/{ => servlet}/HelloWorld.java | 2 +- src/main/webapp/WEB-INF/web.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/de/hsel/itech/{ => servlet}/HelloWorld.java (97%) diff --git a/src/main/java/de/hsel/itech/db/Database.java b/src/main/java/de/hsel/itech/db/Database.java index 44faa36..175c1a0 100644 --- a/src/main/java/de/hsel/itech/db/Database.java +++ b/src/main/java/de/hsel/itech/db/Database.java @@ -35,8 +35,8 @@ public class Database { String hello = ""; try { + assert connection != null; PreparedStatement statement = connection.prepareStatement("SELECT * FROM test WHERE id = 1"); - ResultSet resultSet = statement.executeQuery(); resultSet.next(); hello = resultSet.getString("hello"); diff --git a/src/main/java/de/hsel/itech/HelloWorld.java b/src/main/java/de/hsel/itech/servlet/HelloWorld.java similarity index 97% rename from src/main/java/de/hsel/itech/HelloWorld.java rename to src/main/java/de/hsel/itech/servlet/HelloWorld.java index 0d49078..b22757d 100644 --- a/src/main/java/de/hsel/itech/HelloWorld.java +++ b/src/main/java/de/hsel/itech/servlet/HelloWorld.java @@ -1,4 +1,4 @@ -package de.hsel.itech; +package de.hsel.itech.servlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 45371a9..391a545 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -7,7 +7,7 @@ helloWorld - de.hsel.itech.HelloWorld + de.hsel.itech.servlet.HelloWorld