51 lines
1.6 KiB
Java
51 lines
1.6 KiB
Java
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;
|
|
import java.io.IOException;
|
|
import java.io.PrintWriter;
|
|
|
|
/**
|
|
* Servlet: form to add a book to the database
|
|
*
|
|
*
|
|
* @author Julian Hinxlage
|
|
* @version 0.1
|
|
* @since 0.1
|
|
*/
|
|
|
|
@WebServlet("/addbook")
|
|
public class AddBook extends HttpServlet {
|
|
|
|
|
|
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
|
|
throws IOException {
|
|
|
|
resp.setCharacterEncoding("utf-8");
|
|
PrintWriter out = resp.getWriter();
|
|
|
|
Utillity.insertFile(out, "template_head.html");
|
|
|
|
out.println("<form class=\"m-container\" action=\"booklist\" method=post>");
|
|
Utillity.addValidationInput(out, "ISBN", "isbn", "text", "0", "[0-9]*");
|
|
Utillity.addInput(out,"Titel", "title");
|
|
Utillity.addInput(out,"Author", "author");
|
|
Utillity.addValidationInput(out,"Preis", "price", "text", "0", "[0-9]*(,[0-9]{1,2})?");
|
|
Utillity.addValidationInput(out,"Jahr", "year", "text", "2019", "[0-9]*");
|
|
Utillity.addInput(out,"Beschreibung", "description");
|
|
Utillity.addInput(out,"Verlag", "publisher");
|
|
Utillity.addInput(out,"Kategorie", "category");
|
|
Utillity.addInput(out,"Bild", "image");
|
|
Utillity.addSubmitButton(out, "Hinzufügen");
|
|
out.println("</form>");
|
|
|
|
|
|
Utillity.addButton(out,"Zurück zur Buchliste", "booklist");
|
|
|
|
Utillity.insertFile(out, "template_footer.html");
|
|
}
|
|
|
|
}
|