A
A
Andrew2017-03-01 18:42:11
Java
Andrew, 2017-03-01 18:42:11

Servlet won't start... What's wrong?

In general, here is the project ... It was launched before the norms, a couple of months passed, I changed Windows, I decided to continue my studies and my amateur performance ... but even the servlet does not want me to write the data that is transferred to the database ... not to mention the display of the same data...

https://github.com/Dron73/Guest_book

ab26b4b0d9e04e02bb7b9f1c79d06d74.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey, 2017-03-01
@drox73

he then deploys it, displays a jsp page ... the servlet with methods for adding and deleting does not want for some reason ... I have now commented out everything related to the database, and simply output the string through the printwriter ... But with the methods, he swears at DBWorker class, namely Class.forName("org.postgresql.Driver");
it is not clear why only the postgresql driver is connected to the project. I tried to make another project with a database, where data insertion and data return work as it should. It's about the servlet...

E
Eugene Khrustalev, 2017-03-01
@eugenehr

First you need to make sure that Tomcat deploys the application. To do this:
1. Add to the servlet <load-on-startup>1</load-on-startup>in web.xml
2. Add a method to the servlet

public void init(ServletConfig config) throws ServletException {
    LOG.info("Initialized");
}

and find this entry in the logs

N
Nikolay Baranenko, 2017-03-02
@drno-reg

switch to the modern standard, where
it is possible to completely do without declarations in web.xml
for example,
in the servlet you write:

@WebServlet(
        name = "LoginUser",
        description = "Вход пользователя - проверка имени пользователя и пароля",
        urlPatterns = "/LoginUser"
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question