Servlet找不到maven项目?

时间:2017-02-24 11:23:03

标签: java hibernate maven servlets

所以我不知道这是不是重复,但我徒劳地搜索了类似的错误, 这是事情,我是J2EE新手我开始一个项目(没有hibernate)来吸收基础知识,它工作得很好,现在我去了休眠,我无法解决问题 问题是我无法运行servlet,我不断收到404错误。

Connection.java

@WebServlet("/Connection")
public class Connection extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
 * @see HttpServlet#HttpServlet()
 */
public Connection() {
    super();
    // TODO Auto-generated constructor stub
}

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String login = request.getParameter("login");
    String mdp = request.getParameter("mdp");
    try {
        Utilisateurs.Connection(login,mdp);
        if (Utilisateurs.conected_admin)
        response.sendRedirect("index_admin.jsp");
        else
            response.sendRedirect("Failed.jsp");
    } catch (ClassNotFoundException | SQLException e) {
        e.printStackTrace();

    }


}

/**
 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 */
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);
}

}

        <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Connectez vous !</title>
    </head>
    <body>
    <form action ="Connection" method="POST">
    Login<input type="text" name="login"><br><br>
     Mot de passe<input type="password" name="mdp"><br><br>

    <input type="submit" value="Se Connecter">
</form>
</body>
</html>

0 个答案:

没有答案