Может быть, это простая проблема, но я новичок в JAVA и не понимаю, почему моя простая форма входа не работает.Вот скриншот структуры моего проекта:

Внутри моего index.jsp у меня есть следующая форма:
<form action="/LoginServlet" method="post" enctype="multipart/form-data" class="form-horizontal">
<div class="form-group">
<label>E-Mail Adresse</label>
<input class="au-input au-input--full" type="email" name="un" placeholder="E-Mail">
</div>
<div class="form-group">
<label>Passwort</label>
<input class="au-input au-input--full" type="password" name="pw" placeholder="Passwort">
</div>
<div class="login-checkbox">
<label>
<input type="checkbox" name="remember">Merken
</label>
<label>
<a href="#">Passwort vergessen?</a>
</label>
</div>
<button class="au-btn au-btn--block au-btn--green m-b-20" type="submit">Anmelden</button>
</form>
И мой LoginServlet.java, внутри src-папки, выглядит так:
package controller;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/** * Servlet implementation class LoginServlet */
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException {
try {
UserBean user = new UserBean();
user.setUserName(request.getParameter("un"));
user.setPassword(request.getParameter("pw"));
user = UserDAO.login(user);
if (user.isValid()) {
HttpSession session = request.getSession(true);
session.setAttribute("currentSessionUser",user);
response.sendRedirect("/index.jsp"); //logged-in page
} else
response.sendRedirect("/index.jsp"); //error page
}
catch (Throwable theException) {
System.out.println(theException);
}
}
}
Итак, как вы можете видеть, у меня есть форма с action="/LoginServlet"
.Внутри моего LoginServlet.java я использую @WebServlet("/LoginServlet")
, но как только я отправляю свою форму, я получаю сообщение HTTP Status 404 - Not Found.
Я действительно не понимаю, почему?У кого-нибудь есть идеи, что я делаю не так?Чего мне не хватает?Любая помощь будет очень признательна.