diff --git a/src/main/java/de/hsel/itech/db/Database.java b/src/main/java/de/hsel/itech/db/Database.java
index 9ea4650..2e4e927 100644
--- a/src/main/java/de/hsel/itech/db/Database.java
+++ b/src/main/java/de/hsel/itech/db/Database.java
@@ -97,30 +97,6 @@ public class Database {
return null;
}
- /**
- * testing method.
- *
- * @return String
- */
- @Deprecated
- public String getHello() {
- Connection connection = getConnection();
-
- String hello = "";
- try {
- assert connection != null;
- PreparedStatement statement = connection.prepareStatement("SELECT * FROM test WHERE id = 1");
- ResultSet resultSet = statement.executeQuery();
- if (resultSet.next())
- hello = resultSet.getString("hello");
-
- connection.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return hello;
- }
-
/**
* gets author by id.
*
diff --git a/src/main/java/de/hsel/itech/servlet/AddBook.java b/src/main/java/de/hsel/itech/servlet/AddBook.java
index a53e4d5..32f8e36 100644
--- a/src/main/java/de/hsel/itech/servlet/AddBook.java
+++ b/src/main/java/de/hsel/itech/servlet/AddBook.java
@@ -1,5 +1,6 @@
package de.hsel.itech.servlet;
+import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -14,6 +15,8 @@ import java.io.PrintWriter;
* @version 0.1
* @since 0.1
*/
+
+@WebServlet("/addbook")
public class AddBook extends HttpServlet {
diff --git a/src/main/java/de/hsel/itech/servlet/BookList.java b/src/main/java/de/hsel/itech/servlet/BookList.java
index bacbf33..2e94022 100644
--- a/src/main/java/de/hsel/itech/servlet/BookList.java
+++ b/src/main/java/de/hsel/itech/servlet/BookList.java
@@ -6,6 +6,7 @@ import de.hsel.itech.db.pojo.Book;
import de.hsel.itech.db.pojo.Category;
import de.hsel.itech.db.pojo.Publisher;
+import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -24,6 +25,8 @@ import java.util.List;
* @version 0.1
* @since 0.1
*/
+
+@WebServlet("/booklist")
public class BookList extends HttpServlet {
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
@@ -92,8 +95,7 @@ public class BookList extends HttpServlet {
for (String name : authorNames) {
authors.add(new Author(name));
}
- Category category = new Category();
- category.setName(categoryName);
+ Category category = new Category(categoryName);
Book book = new Book(isbn,
authors,
new Publisher(publisher),
@@ -133,10 +135,13 @@ public class BookList extends HttpServlet {
out.println("
" + book.getTitle() + "
");
out.println("ISBN: " + book.getIsbn() + "");
- for (int i = 0; i < book.getAuthors().size(); i++) {
- out.println("von " + book.getAuthors().get(0).getName());
+ List authors = new ArrayList<>();
+ for(Author author : book.getAuthors()) {
+ authors.add(author.getName());
}
+ out.println("von: " + String.join(", ", authors));
+
out.println("Veröffentlicht von " + book.getPublisher().getName() + "");
out.println("" + book.getDescription() + "");
diff --git a/src/main/java/de/hsel/itech/servlet/DbTest.java b/src/main/java/de/hsel/itech/servlet/DbTest.java
deleted file mode 100644
index db86770..0000000
--- a/src/main/java/de/hsel/itech/servlet/DbTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package de.hsel.itech.servlet;
-
-import de.hsel.itech.db.Database;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * Database test.
- *
- * @author Johannes Theiner
- * @version 0.1
- * @since 0.1
- **/
-public class DbTest extends HttpServlet {
-
- private static final long serialVersionUID = 15679036734L;
-
- /**
- * doGet.
- *
- * @param req Request
- * @param resp Response
- * @throws IOException failed
- */
- @Override
- protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
- throws IOException {
-
- resp.setContentType("text/html");
- final PrintWriter out = resp.getWriter();
- out.println("");
- out.println("");
- out.println("Hallo Welt!");
- out.println("");
- out.println("");
- out.println("" + Database.getInstance().getHello() + "
");
- out.println("");
- out.println("");
- }
-}
\ No newline at end of file
diff --git a/src/main/java/de/hsel/itech/servlet/HelloWorld.java b/src/main/java/de/hsel/itech/servlet/HelloWorld.java
deleted file mode 100644
index 9aa5a44..0000000
--- a/src/main/java/de/hsel/itech/servlet/HelloWorld.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package de.hsel.itech.servlet;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-/**
- * Hello World.
- *
- * @author Johannes Theiner
- * @version 0.1
- * @since 0.1
- **/
-public class HelloWorld extends HttpServlet {
-
- private static final long serialVersionUID = 15679036735L;
-
- /**
- * doGet.
- *
- * @param req Request
- * @param resp Response
- * @throws IOException failed
- */
- @Override
- protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
- throws IOException {
-
- resp.setContentType("text/html");
- final PrintWriter out = resp.getWriter();
- out.println("");
- out.println("");
- out.println("");
- out.println("Hallo Welt!");
- out.println("");
- out.println("");
- out.println("Hallo Ostfriesland!
");
- out.println("" + System.getProperty("catalina.base") + "
");
- out.println("" + new File("").getAbsolutePath() + "
");
- out.println("");
- out.println("");
- }
-}
diff --git a/src/main/resources/template_footer.html b/src/main/resources/template_footer.html
index c0a0803..79088c3 100644
--- a/src/main/resources/template_footer.html
+++ b/src/main/resources/template_footer.html
@@ -28,9 +28,9 @@
-
+
Rechtliches
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 760482f..0000000
--- a/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- helloWorld
- de.hsel.itech.servlet.HelloWorld
-
-
-
- database
- de.hsel.itech.servlet.DbTest
-
-
-
- booklist
- de.hsel.itech.servlet.BookList
-
-
-
- addbook
- de.hsel.itech.servlet.AddBook
-
-
-
- helloWorld
- /index
-
-
-
- database
- /db
-
-
-
- booklist
- /booklist
-
-
-
- addbook
- /addbook
-
-
\ No newline at end of file
diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html
new file mode 100644
index 0000000..ef273a3
--- /dev/null
+++ b/src/main/webapp/index.html
@@ -0,0 +1,12 @@
+
+
+
+
Internet Technologien
+
+
+
+
+
\ No newline at end of file