JSP Servlet HTTP Status 404 – Not Found The 2019 Stack Overflow Developer Survey Results Are InServlet for serving static contentWhat is the difference between JSF, Servlet and JSP?How to upload files to server using JSP/Servlet?How to use java.net.URLConnection to fire and handle HTTP requestsHow do servlets work? Instantiation, sessions, shared variables and multithreadingHow to avoid Java code in JSP files?How to use Servlets and Ajax?What is Java Servlet?HTTP status 404 - servlet jspHTTP Status 404 - Not Found - Servlet and JSP

Inflated grade on resume at previous job, might former employer tell new employer?

Geography at the pixel level

Can't find the latex code for the ⍎ (down tack jot) symbol

How to answer pointed "are you quitting" questioning when I don't want them to suspect

Why is my p-value correlated to difference between means in two sample tests?

A poker game description that does not feel gimmicky

Inversion Puzzle

How can I create a character who can assume the widest possible range of creature sizes?

Are USB sockets on wall outlets live all the time, even when the switch is off?

What does "rabbited" mean/imply in this sentence?

aging parents with no investments

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

What is the meaning of Triage in Cybersec world?

Deadlock Graph and Interpretation, solution to avoid

"What time...?" or "At what time...?" - what is more grammatically correct?

Could JWST stay at L2 "forever"?

Is it possible for the two major parties in the UK to form a coalition with each other instead of a much smaller party?

Access elements in std::string where positon of string is greater than its size

Is there a name of the flying bionic bird?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

Output the Arecibo Message

What is the steepest angle that a canal can be traversable without locks?

Springs with some finite mass

On the insanity of kings as an argument against monarchy



JSP Servlet HTTP Status 404 – Not Found



The 2019 Stack Overflow Developer Survey Results Are InServlet for serving static contentWhat is the difference between JSF, Servlet and JSP?How to upload files to server using JSP/Servlet?How to use java.net.URLConnection to fire and handle HTTP requestsHow do servlets work? Instantiation, sessions, shared variables and multithreadingHow to avoid Java code in JSP files?How to use Servlets and Ajax?What is Java Servlet?HTTP status 404 - servlet jspHTTP Status 404 - Not Found - Servlet and JSP



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















This is my first post. I hope someone can help me =)
Usually I'll try to find solutions to this kind of problems on my own.
But this issue is causing me headache ...



With the action tag in the html code below I want to start the java servlet.
Sadly I always get the HTTP 404 - Not found error.
I've already tried to write /Login, ../Login, Login (upper and lower case) and so on.



Here is my directory structure:



.
├── ps_18_gruppe09
│ └── src
│ ├── main
│ │ └── com.food42.servlet
│ │ └── LoginServelet.java
│ WebContent
│ ├── html
│ │ └── login.jsp
│ └── WEB-INF
│ └── lib
│ └── web.xml


I've already tried the solutions answered on similar kind of posts but they sadly didn't help.



In my Java Build Path I've the following Libraries installed:
Apache Tomcat v8.5
JRE System Library[jre1.8.0_201a]
Web App Libraries
MySQL JDBC Driver
EAR Libraries
JUnit5
log4j-1.2.17.jar



Source Folder is ps_18_gruppe09/src/main



Full error message:




HTTP Status 404 – Not Found



Type Status Report



Message /ps_18_gruppe09/Login



Description The origin server did not find a current representation
for the target resource or is not willing to disclose that one exists.



Apache Tomcat/8.5.35




Thanks in advance for your help =)



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>ServletDBLog4j</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>dbUser</param-name>
<param-value>admin</param-value>
</context-param>
<context-param>
<param-name>dbPassword</param-name>
<param-value>Food42</param-value>
</context-param>
<context-param>
<param-name>dbURL</param-name>
<param-value>jdbc:mysql://localhost/</param-value>
</context-param>
<context-param>
<param-name>log4j-config</param-name>
<param-value>WEB-INF/lib/log4j.xml</param-value>
</context-param>

<error-page>
<error-code>404</error-code>
<location>/AppErrorHandler</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/AppErrorHandler</location>
</error-page>

<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>com.food42.servlet.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>


<%@ page contentType="text/html; charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Food42 Login Page</title>

<!-- Bootstrap core CSS -->
<link href="../vendor/bootstrap/css/bootstrap.css" rel="stylesheet">

<!-- Custom fonts for this template -->
<link href="../vendor/fontawesome-free/css/all.min.css" rel="stylesheet"
type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700"
rel="stylesheet" type="text/css">
<link
href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic"
rel="stylesheet" type="text/css">

<!-- Plugin CSS -->
<link href="../vendor/magnific-popup/magnific-popup.css"
rel="stylesheet" type="text/css">

<!-- Custom styles for this template -->
<link href="../css/freelancer.css" rel="stylesheet">

</head>

<body id="page-top">
<!-- Navigation -->
<nav
class="navbar navbar-expand-lg bg-secondary fixed-top text-uppercase"
id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="startseite.html">Food42</a>
<button
class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded"
type="button" data-toggle="collapse" data-target="#navbarResponsive"
aria-controls="navbarResponsive" aria-expanded="false"
aria-label="Toggle navigation">
Menu <i class="fas fa-bars"></i>
</button>
<div class="topnav">
<input type="text" placeholder="Suchen...">
</div>
<form action="suchresultate.html">
<input type="submit" value="Suchen" class="searchButton" />
</form>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item mx-0 mx-lg-1"><a
class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger"
href="register.html">Registrieren</a></li>
</ul>
</div>
</div>
</nav>

<!-- Header -->
<header class="masthead bg-primary text-white text-center"> </header>

<!-- Portfolio Grid Section -->
<section class="portfolio" id="portfolio">
<div class="container">
<h2 class="text-center text-uppercase text-secondary mb-0">Benutzer-Login</h2>
<hr class="star-dark mb-5">
<form action="$pageContext.request.contextPath/Login" method="post">
<h3 class="text-center">Bitte geben Sie Ihre Login-Daten ein:</h3>
<fieldset class="container" style="width: 400px">
<table style="width: 400px">
<tr>
<th><label class="mt-2 mb-2" for="username">Username:</label></th>
<td><input type="text" id="username" name="username"
required autofocus /></td>
</tr>
<tr>
<th><label class="mt-2 mb-2" for="password">Password:</label></th>
<td><input type="password" id="password" name="password"
required /></td>
</tr>
<tr>
<th><label class="mt-2 mb-2" for="pwdconfirm">Best&auml;tigen:</label></th>
<td><input type="password" id="pwdconfirm" name="pwdconfirm"
required /></td>
</tr>
<tr>
<th><label class="mt-4 mb-3 " for="submit"></label> <input
type="submit" id="submit" name="submit" value="Login" /></th>
</tr>
</table>
</fieldset>
</form>
</div>
</section>

<!-- Footer -->
<footer class="footer text-center">
<div class="container">
<div class="row">
<div class="col-md-4 mb-5 mb-lg-0">
<h4 class="text-uppercase mb-4">Location</h4>
<p class="lead mb-0">
ZHAW Winterthur <br>Technikum
</p>
</div>
<div class="col-md-4 mb-5 mb-lg-0">
<h4 class="text-uppercase mb-4">Around the Web</h4>
<ul class="list-inline mb-0">
<li class="list-inline-item"><a
class="btn btn-outline-light btn-social text-center rounded-circle"
href="https://www.facebook.com/Food42ch-954018978130563/?modal=admin_todo_tour">
<i class="fab fa-fw fa-facebook-f"></i>
</a></li>
<li class="list-inline-item"><a
class="btn btn-outline-light btn-social text-center rounded-circle"
href="https://twitter.com/Food42C?edit=true"> <i
class="fab fa-fw fa-twitter"></i>
</a></li>
<li class="list-inline-item"><a
class="btn btn-outline-light btn-social text-center rounded-circle"
href="https://www.linkedin.com/company/food42-ch/"> <i
class="fab fa-fw fa-linkedin-in"></i>
</a></li>
</ul>
</div>
<div class="col-md-4">
<h4 class="text-uppercase mb-4">Food42</h4>
<p class="lead mb-0">Share your food
</div>
</div>
</div>
</footer>

<div class="copyright py-4 text-center text-white">
<div class="container">
<small>Copyright &copy; Food42 2018</small>
</div>
</div>

<!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
<div class="scroll-to-top d-lg-none position-fixed ">
<a class="js-scroll-trigger d-block text-center text-white rounded"
href="#page-top"> <i class="fa fa-chevron-up"></i>
</a>
</div>

<!-- Bootstrap core JavaScript -->
<script src="../vendor/jquery/jquery.min.js"></script>
<script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

<!-- Plugin JavaScript -->
<script src="../vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="../vendor/magnific-popup/jquery.magnific-popup.min.js"></script>

<!-- Contact Form JavaScript -->
<script src="../js/jqBootstrapValidation.js"></script>
<script src="../js/contact_me.js"></script>

<!-- Custom scripts for this template -->
<script src="../js/freelancer.min.js"></script>

</body>

</html>




package com.food42.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
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;

import org.apache.log4j.Logger;
import com.food42.util.User;

@WebServlet(name = "Login", urlPatterns = "/Login")
public class LoginServlet extends HttpServlet
private static final long serialVersionUID = 1L;

static Logger logger = Logger.getLogger(LoginServlet.class);

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException










share|improve this question






























    0















    This is my first post. I hope someone can help me =)
    Usually I'll try to find solutions to this kind of problems on my own.
    But this issue is causing me headache ...



    With the action tag in the html code below I want to start the java servlet.
    Sadly I always get the HTTP 404 - Not found error.
    I've already tried to write /Login, ../Login, Login (upper and lower case) and so on.



    Here is my directory structure:



    .
    ├── ps_18_gruppe09
    │ └── src
    │ ├── main
    │ │ └── com.food42.servlet
    │ │ └── LoginServelet.java
    │ WebContent
    │ ├── html
    │ │ └── login.jsp
    │ └── WEB-INF
    │ └── lib
    │ └── web.xml


    I've already tried the solutions answered on similar kind of posts but they sadly didn't help.



    In my Java Build Path I've the following Libraries installed:
    Apache Tomcat v8.5
    JRE System Library[jre1.8.0_201a]
    Web App Libraries
    MySQL JDBC Driver
    EAR Libraries
    JUnit5
    log4j-1.2.17.jar



    Source Folder is ps_18_gruppe09/src/main



    Full error message:




    HTTP Status 404 – Not Found



    Type Status Report



    Message /ps_18_gruppe09/Login



    Description The origin server did not find a current representation
    for the target resource or is not willing to disclose that one exists.



    Apache Tomcat/8.5.35




    Thanks in advance for your help =)



    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
    <display-name>ServletDBLog4j</display-name>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    <context-param>
    <param-name>dbUser</param-name>
    <param-value>admin</param-value>
    </context-param>
    <context-param>
    <param-name>dbPassword</param-name>
    <param-value>Food42</param-value>
    </context-param>
    <context-param>
    <param-name>dbURL</param-name>
    <param-value>jdbc:mysql://localhost/</param-value>
    </context-param>
    <context-param>
    <param-name>log4j-config</param-name>
    <param-value>WEB-INF/lib/log4j.xml</param-value>
    </context-param>

    <error-page>
    <error-code>404</error-code>
    <location>/AppErrorHandler</location>
    </error-page>
    <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/AppErrorHandler</location>
    </error-page>

    <filter>
    <filter-name>AuthenticationFilter</filter-name>
    <filter-class>com.food42.servlet.AuthenticationFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>AuthenticationFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    </web-app>


    <%@ page contentType="text/html; charset=UTF-8" language="java" %>

    <!DOCTYPE html>
    <html lang="en">

    <head>

    <meta charset="utf-8">
    <meta name="viewport"
    content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Food42 Login Page</title>

    <!-- Bootstrap core CSS -->
    <link href="../vendor/bootstrap/css/bootstrap.css" rel="stylesheet">

    <!-- Custom fonts for this template -->
    <link href="../vendor/fontawesome-free/css/all.min.css" rel="stylesheet"
    type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700"
    rel="stylesheet" type="text/css">
    <link
    href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic"
    rel="stylesheet" type="text/css">

    <!-- Plugin CSS -->
    <link href="../vendor/magnific-popup/magnific-popup.css"
    rel="stylesheet" type="text/css">

    <!-- Custom styles for this template -->
    <link href="../css/freelancer.css" rel="stylesheet">

    </head>

    <body id="page-top">
    <!-- Navigation -->
    <nav
    class="navbar navbar-expand-lg bg-secondary fixed-top text-uppercase"
    id="mainNav">
    <div class="container">
    <a class="navbar-brand js-scroll-trigger" href="startseite.html">Food42</a>
    <button
    class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded"
    type="button" data-toggle="collapse" data-target="#navbarResponsive"
    aria-controls="navbarResponsive" aria-expanded="false"
    aria-label="Toggle navigation">
    Menu <i class="fas fa-bars"></i>
    </button>
    <div class="topnav">
    <input type="text" placeholder="Suchen...">
    </div>
    <form action="suchresultate.html">
    <input type="submit" value="Suchen" class="searchButton" />
    </form>
    <div class="collapse navbar-collapse" id="navbarResponsive">
    <ul class="navbar-nav ml-auto">
    <li class="nav-item mx-0 mx-lg-1"><a
    class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger"
    href="register.html">Registrieren</a></li>
    </ul>
    </div>
    </div>
    </nav>

    <!-- Header -->
    <header class="masthead bg-primary text-white text-center"> </header>

    <!-- Portfolio Grid Section -->
    <section class="portfolio" id="portfolio">
    <div class="container">
    <h2 class="text-center text-uppercase text-secondary mb-0">Benutzer-Login</h2>
    <hr class="star-dark mb-5">
    <form action="$pageContext.request.contextPath/Login" method="post">
    <h3 class="text-center">Bitte geben Sie Ihre Login-Daten ein:</h3>
    <fieldset class="container" style="width: 400px">
    <table style="width: 400px">
    <tr>
    <th><label class="mt-2 mb-2" for="username">Username:</label></th>
    <td><input type="text" id="username" name="username"
    required autofocus /></td>
    </tr>
    <tr>
    <th><label class="mt-2 mb-2" for="password">Password:</label></th>
    <td><input type="password" id="password" name="password"
    required /></td>
    </tr>
    <tr>
    <th><label class="mt-2 mb-2" for="pwdconfirm">Best&auml;tigen:</label></th>
    <td><input type="password" id="pwdconfirm" name="pwdconfirm"
    required /></td>
    </tr>
    <tr>
    <th><label class="mt-4 mb-3 " for="submit"></label> <input
    type="submit" id="submit" name="submit" value="Login" /></th>
    </tr>
    </table>
    </fieldset>
    </form>
    </div>
    </section>

    <!-- Footer -->
    <footer class="footer text-center">
    <div class="container">
    <div class="row">
    <div class="col-md-4 mb-5 mb-lg-0">
    <h4 class="text-uppercase mb-4">Location</h4>
    <p class="lead mb-0">
    ZHAW Winterthur <br>Technikum
    </p>
    </div>
    <div class="col-md-4 mb-5 mb-lg-0">
    <h4 class="text-uppercase mb-4">Around the Web</h4>
    <ul class="list-inline mb-0">
    <li class="list-inline-item"><a
    class="btn btn-outline-light btn-social text-center rounded-circle"
    href="https://www.facebook.com/Food42ch-954018978130563/?modal=admin_todo_tour">
    <i class="fab fa-fw fa-facebook-f"></i>
    </a></li>
    <li class="list-inline-item"><a
    class="btn btn-outline-light btn-social text-center rounded-circle"
    href="https://twitter.com/Food42C?edit=true"> <i
    class="fab fa-fw fa-twitter"></i>
    </a></li>
    <li class="list-inline-item"><a
    class="btn btn-outline-light btn-social text-center rounded-circle"
    href="https://www.linkedin.com/company/food42-ch/"> <i
    class="fab fa-fw fa-linkedin-in"></i>
    </a></li>
    </ul>
    </div>
    <div class="col-md-4">
    <h4 class="text-uppercase mb-4">Food42</h4>
    <p class="lead mb-0">Share your food
    </div>
    </div>
    </div>
    </footer>

    <div class="copyright py-4 text-center text-white">
    <div class="container">
    <small>Copyright &copy; Food42 2018</small>
    </div>
    </div>

    <!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
    <div class="scroll-to-top d-lg-none position-fixed ">
    <a class="js-scroll-trigger d-block text-center text-white rounded"
    href="#page-top"> <i class="fa fa-chevron-up"></i>
    </a>
    </div>

    <!-- Bootstrap core JavaScript -->
    <script src="../vendor/jquery/jquery.min.js"></script>
    <script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

    <!-- Plugin JavaScript -->
    <script src="../vendor/jquery-easing/jquery.easing.min.js"></script>
    <script src="../vendor/magnific-popup/jquery.magnific-popup.min.js"></script>

    <!-- Contact Form JavaScript -->
    <script src="../js/jqBootstrapValidation.js"></script>
    <script src="../js/contact_me.js"></script>

    <!-- Custom scripts for this template -->
    <script src="../js/freelancer.min.js"></script>

    </body>

    </html>




    package com.food42.servlet;

    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;

    import javax.servlet.RequestDispatcher;
    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;

    import org.apache.log4j.Logger;
    import com.food42.util.User;

    @WebServlet(name = "Login", urlPatterns = "/Login")
    public class LoginServlet extends HttpServlet
    private static final long serialVersionUID = 1L;

    static Logger logger = Logger.getLogger(LoginServlet.class);

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException










    share|improve this question


























      0












      0








      0








      This is my first post. I hope someone can help me =)
      Usually I'll try to find solutions to this kind of problems on my own.
      But this issue is causing me headache ...



      With the action tag in the html code below I want to start the java servlet.
      Sadly I always get the HTTP 404 - Not found error.
      I've already tried to write /Login, ../Login, Login (upper and lower case) and so on.



      Here is my directory structure:



      .
      ├── ps_18_gruppe09
      │ └── src
      │ ├── main
      │ │ └── com.food42.servlet
      │ │ └── LoginServelet.java
      │ WebContent
      │ ├── html
      │ │ └── login.jsp
      │ └── WEB-INF
      │ └── lib
      │ └── web.xml


      I've already tried the solutions answered on similar kind of posts but they sadly didn't help.



      In my Java Build Path I've the following Libraries installed:
      Apache Tomcat v8.5
      JRE System Library[jre1.8.0_201a]
      Web App Libraries
      MySQL JDBC Driver
      EAR Libraries
      JUnit5
      log4j-1.2.17.jar



      Source Folder is ps_18_gruppe09/src/main



      Full error message:




      HTTP Status 404 – Not Found



      Type Status Report



      Message /ps_18_gruppe09/Login



      Description The origin server did not find a current representation
      for the target resource or is not willing to disclose that one exists.



      Apache Tomcat/8.5.35




      Thanks in advance for your help =)



      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
      <display-name>ServletDBLog4j</display-name>
      <welcome-file-list>
      <welcome-file>login.jsp</welcome-file>
      </welcome-file-list>
      <context-param>
      <param-name>dbUser</param-name>
      <param-value>admin</param-value>
      </context-param>
      <context-param>
      <param-name>dbPassword</param-name>
      <param-value>Food42</param-value>
      </context-param>
      <context-param>
      <param-name>dbURL</param-name>
      <param-value>jdbc:mysql://localhost/</param-value>
      </context-param>
      <context-param>
      <param-name>log4j-config</param-name>
      <param-value>WEB-INF/lib/log4j.xml</param-value>
      </context-param>

      <error-page>
      <error-code>404</error-code>
      <location>/AppErrorHandler</location>
      </error-page>
      <error-page>
      <exception-type>java.lang.Throwable</exception-type>
      <location>/AppErrorHandler</location>
      </error-page>

      <filter>
      <filter-name>AuthenticationFilter</filter-name>
      <filter-class>com.food42.servlet.AuthenticationFilter</filter-class>
      </filter>
      <filter-mapping>
      <filter-name>AuthenticationFilter</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>

      </web-app>


      <%@ page contentType="text/html; charset=UTF-8" language="java" %>

      <!DOCTYPE html>
      <html lang="en">

      <head>

      <meta charset="utf-8">
      <meta name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <meta name="description" content="">
      <meta name="author" content="">

      <title>Food42 Login Page</title>

      <!-- Bootstrap core CSS -->
      <link href="../vendor/bootstrap/css/bootstrap.css" rel="stylesheet">

      <!-- Custom fonts for this template -->
      <link href="../vendor/fontawesome-free/css/all.min.css" rel="stylesheet"
      type="text/css">
      <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700"
      rel="stylesheet" type="text/css">
      <link
      href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic"
      rel="stylesheet" type="text/css">

      <!-- Plugin CSS -->
      <link href="../vendor/magnific-popup/magnific-popup.css"
      rel="stylesheet" type="text/css">

      <!-- Custom styles for this template -->
      <link href="../css/freelancer.css" rel="stylesheet">

      </head>

      <body id="page-top">
      <!-- Navigation -->
      <nav
      class="navbar navbar-expand-lg bg-secondary fixed-top text-uppercase"
      id="mainNav">
      <div class="container">
      <a class="navbar-brand js-scroll-trigger" href="startseite.html">Food42</a>
      <button
      class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded"
      type="button" data-toggle="collapse" data-target="#navbarResponsive"
      aria-controls="navbarResponsive" aria-expanded="false"
      aria-label="Toggle navigation">
      Menu <i class="fas fa-bars"></i>
      </button>
      <div class="topnav">
      <input type="text" placeholder="Suchen...">
      </div>
      <form action="suchresultate.html">
      <input type="submit" value="Suchen" class="searchButton" />
      </form>
      <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
      <li class="nav-item mx-0 mx-lg-1"><a
      class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger"
      href="register.html">Registrieren</a></li>
      </ul>
      </div>
      </div>
      </nav>

      <!-- Header -->
      <header class="masthead bg-primary text-white text-center"> </header>

      <!-- Portfolio Grid Section -->
      <section class="portfolio" id="portfolio">
      <div class="container">
      <h2 class="text-center text-uppercase text-secondary mb-0">Benutzer-Login</h2>
      <hr class="star-dark mb-5">
      <form action="$pageContext.request.contextPath/Login" method="post">
      <h3 class="text-center">Bitte geben Sie Ihre Login-Daten ein:</h3>
      <fieldset class="container" style="width: 400px">
      <table style="width: 400px">
      <tr>
      <th><label class="mt-2 mb-2" for="username">Username:</label></th>
      <td><input type="text" id="username" name="username"
      required autofocus /></td>
      </tr>
      <tr>
      <th><label class="mt-2 mb-2" for="password">Password:</label></th>
      <td><input type="password" id="password" name="password"
      required /></td>
      </tr>
      <tr>
      <th><label class="mt-2 mb-2" for="pwdconfirm">Best&auml;tigen:</label></th>
      <td><input type="password" id="pwdconfirm" name="pwdconfirm"
      required /></td>
      </tr>
      <tr>
      <th><label class="mt-4 mb-3 " for="submit"></label> <input
      type="submit" id="submit" name="submit" value="Login" /></th>
      </tr>
      </table>
      </fieldset>
      </form>
      </div>
      </section>

      <!-- Footer -->
      <footer class="footer text-center">
      <div class="container">
      <div class="row">
      <div class="col-md-4 mb-5 mb-lg-0">
      <h4 class="text-uppercase mb-4">Location</h4>
      <p class="lead mb-0">
      ZHAW Winterthur <br>Technikum
      </p>
      </div>
      <div class="col-md-4 mb-5 mb-lg-0">
      <h4 class="text-uppercase mb-4">Around the Web</h4>
      <ul class="list-inline mb-0">
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://www.facebook.com/Food42ch-954018978130563/?modal=admin_todo_tour">
      <i class="fab fa-fw fa-facebook-f"></i>
      </a></li>
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://twitter.com/Food42C?edit=true"> <i
      class="fab fa-fw fa-twitter"></i>
      </a></li>
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://www.linkedin.com/company/food42-ch/"> <i
      class="fab fa-fw fa-linkedin-in"></i>
      </a></li>
      </ul>
      </div>
      <div class="col-md-4">
      <h4 class="text-uppercase mb-4">Food42</h4>
      <p class="lead mb-0">Share your food
      </div>
      </div>
      </div>
      </footer>

      <div class="copyright py-4 text-center text-white">
      <div class="container">
      <small>Copyright &copy; Food42 2018</small>
      </div>
      </div>

      <!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
      <div class="scroll-to-top d-lg-none position-fixed ">
      <a class="js-scroll-trigger d-block text-center text-white rounded"
      href="#page-top"> <i class="fa fa-chevron-up"></i>
      </a>
      </div>

      <!-- Bootstrap core JavaScript -->
      <script src="../vendor/jquery/jquery.min.js"></script>
      <script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

      <!-- Plugin JavaScript -->
      <script src="../vendor/jquery-easing/jquery.easing.min.js"></script>
      <script src="../vendor/magnific-popup/jquery.magnific-popup.min.js"></script>

      <!-- Contact Form JavaScript -->
      <script src="../js/jqBootstrapValidation.js"></script>
      <script src="../js/contact_me.js"></script>

      <!-- Custom scripts for this template -->
      <script src="../js/freelancer.min.js"></script>

      </body>

      </html>




      package com.food42.servlet;

      import java.io.IOException;
      import java.io.PrintWriter;
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;

      import javax.servlet.RequestDispatcher;
      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;

      import org.apache.log4j.Logger;
      import com.food42.util.User;

      @WebServlet(name = "Login", urlPatterns = "/Login")
      public class LoginServlet extends HttpServlet
      private static final long serialVersionUID = 1L;

      static Logger logger = Logger.getLogger(LoginServlet.class);

      @Override
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException










      share|improve this question
















      This is my first post. I hope someone can help me =)
      Usually I'll try to find solutions to this kind of problems on my own.
      But this issue is causing me headache ...



      With the action tag in the html code below I want to start the java servlet.
      Sadly I always get the HTTP 404 - Not found error.
      I've already tried to write /Login, ../Login, Login (upper and lower case) and so on.



      Here is my directory structure:



      .
      ├── ps_18_gruppe09
      │ └── src
      │ ├── main
      │ │ └── com.food42.servlet
      │ │ └── LoginServelet.java
      │ WebContent
      │ ├── html
      │ │ └── login.jsp
      │ └── WEB-INF
      │ └── lib
      │ └── web.xml


      I've already tried the solutions answered on similar kind of posts but they sadly didn't help.



      In my Java Build Path I've the following Libraries installed:
      Apache Tomcat v8.5
      JRE System Library[jre1.8.0_201a]
      Web App Libraries
      MySQL JDBC Driver
      EAR Libraries
      JUnit5
      log4j-1.2.17.jar



      Source Folder is ps_18_gruppe09/src/main



      Full error message:




      HTTP Status 404 – Not Found



      Type Status Report



      Message /ps_18_gruppe09/Login



      Description The origin server did not find a current representation
      for the target resource or is not willing to disclose that one exists.



      Apache Tomcat/8.5.35




      Thanks in advance for your help =)



      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
      <display-name>ServletDBLog4j</display-name>
      <welcome-file-list>
      <welcome-file>login.jsp</welcome-file>
      </welcome-file-list>
      <context-param>
      <param-name>dbUser</param-name>
      <param-value>admin</param-value>
      </context-param>
      <context-param>
      <param-name>dbPassword</param-name>
      <param-value>Food42</param-value>
      </context-param>
      <context-param>
      <param-name>dbURL</param-name>
      <param-value>jdbc:mysql://localhost/</param-value>
      </context-param>
      <context-param>
      <param-name>log4j-config</param-name>
      <param-value>WEB-INF/lib/log4j.xml</param-value>
      </context-param>

      <error-page>
      <error-code>404</error-code>
      <location>/AppErrorHandler</location>
      </error-page>
      <error-page>
      <exception-type>java.lang.Throwable</exception-type>
      <location>/AppErrorHandler</location>
      </error-page>

      <filter>
      <filter-name>AuthenticationFilter</filter-name>
      <filter-class>com.food42.servlet.AuthenticationFilter</filter-class>
      </filter>
      <filter-mapping>
      <filter-name>AuthenticationFilter</filter-name>
      <url-pattern>/*</url-pattern>
      </filter-mapping>

      </web-app>


      <%@ page contentType="text/html; charset=UTF-8" language="java" %>

      <!DOCTYPE html>
      <html lang="en">

      <head>

      <meta charset="utf-8">
      <meta name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <meta name="description" content="">
      <meta name="author" content="">

      <title>Food42 Login Page</title>

      <!-- Bootstrap core CSS -->
      <link href="../vendor/bootstrap/css/bootstrap.css" rel="stylesheet">

      <!-- Custom fonts for this template -->
      <link href="../vendor/fontawesome-free/css/all.min.css" rel="stylesheet"
      type="text/css">
      <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700"
      rel="stylesheet" type="text/css">
      <link
      href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic"
      rel="stylesheet" type="text/css">

      <!-- Plugin CSS -->
      <link href="../vendor/magnific-popup/magnific-popup.css"
      rel="stylesheet" type="text/css">

      <!-- Custom styles for this template -->
      <link href="../css/freelancer.css" rel="stylesheet">

      </head>

      <body id="page-top">
      <!-- Navigation -->
      <nav
      class="navbar navbar-expand-lg bg-secondary fixed-top text-uppercase"
      id="mainNav">
      <div class="container">
      <a class="navbar-brand js-scroll-trigger" href="startseite.html">Food42</a>
      <button
      class="navbar-toggler navbar-toggler-right text-uppercase bg-primary text-white rounded"
      type="button" data-toggle="collapse" data-target="#navbarResponsive"
      aria-controls="navbarResponsive" aria-expanded="false"
      aria-label="Toggle navigation">
      Menu <i class="fas fa-bars"></i>
      </button>
      <div class="topnav">
      <input type="text" placeholder="Suchen...">
      </div>
      <form action="suchresultate.html">
      <input type="submit" value="Suchen" class="searchButton" />
      </form>
      <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
      <li class="nav-item mx-0 mx-lg-1"><a
      class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger"
      href="register.html">Registrieren</a></li>
      </ul>
      </div>
      </div>
      </nav>

      <!-- Header -->
      <header class="masthead bg-primary text-white text-center"> </header>

      <!-- Portfolio Grid Section -->
      <section class="portfolio" id="portfolio">
      <div class="container">
      <h2 class="text-center text-uppercase text-secondary mb-0">Benutzer-Login</h2>
      <hr class="star-dark mb-5">
      <form action="$pageContext.request.contextPath/Login" method="post">
      <h3 class="text-center">Bitte geben Sie Ihre Login-Daten ein:</h3>
      <fieldset class="container" style="width: 400px">
      <table style="width: 400px">
      <tr>
      <th><label class="mt-2 mb-2" for="username">Username:</label></th>
      <td><input type="text" id="username" name="username"
      required autofocus /></td>
      </tr>
      <tr>
      <th><label class="mt-2 mb-2" for="password">Password:</label></th>
      <td><input type="password" id="password" name="password"
      required /></td>
      </tr>
      <tr>
      <th><label class="mt-2 mb-2" for="pwdconfirm">Best&auml;tigen:</label></th>
      <td><input type="password" id="pwdconfirm" name="pwdconfirm"
      required /></td>
      </tr>
      <tr>
      <th><label class="mt-4 mb-3 " for="submit"></label> <input
      type="submit" id="submit" name="submit" value="Login" /></th>
      </tr>
      </table>
      </fieldset>
      </form>
      </div>
      </section>

      <!-- Footer -->
      <footer class="footer text-center">
      <div class="container">
      <div class="row">
      <div class="col-md-4 mb-5 mb-lg-0">
      <h4 class="text-uppercase mb-4">Location</h4>
      <p class="lead mb-0">
      ZHAW Winterthur <br>Technikum
      </p>
      </div>
      <div class="col-md-4 mb-5 mb-lg-0">
      <h4 class="text-uppercase mb-4">Around the Web</h4>
      <ul class="list-inline mb-0">
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://www.facebook.com/Food42ch-954018978130563/?modal=admin_todo_tour">
      <i class="fab fa-fw fa-facebook-f"></i>
      </a></li>
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://twitter.com/Food42C?edit=true"> <i
      class="fab fa-fw fa-twitter"></i>
      </a></li>
      <li class="list-inline-item"><a
      class="btn btn-outline-light btn-social text-center rounded-circle"
      href="https://www.linkedin.com/company/food42-ch/"> <i
      class="fab fa-fw fa-linkedin-in"></i>
      </a></li>
      </ul>
      </div>
      <div class="col-md-4">
      <h4 class="text-uppercase mb-4">Food42</h4>
      <p class="lead mb-0">Share your food
      </div>
      </div>
      </div>
      </footer>

      <div class="copyright py-4 text-center text-white">
      <div class="container">
      <small>Copyright &copy; Food42 2018</small>
      </div>
      </div>

      <!-- Scroll to Top Button (Only visible on small and extra-small screen sizes) -->
      <div class="scroll-to-top d-lg-none position-fixed ">
      <a class="js-scroll-trigger d-block text-center text-white rounded"
      href="#page-top"> <i class="fa fa-chevron-up"></i>
      </a>
      </div>

      <!-- Bootstrap core JavaScript -->
      <script src="../vendor/jquery/jquery.min.js"></script>
      <script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

      <!-- Plugin JavaScript -->
      <script src="../vendor/jquery-easing/jquery.easing.min.js"></script>
      <script src="../vendor/magnific-popup/jquery.magnific-popup.min.js"></script>

      <!-- Contact Form JavaScript -->
      <script src="../js/jqBootstrapValidation.js"></script>
      <script src="../js/contact_me.js"></script>

      <!-- Custom scripts for this template -->
      <script src="../js/freelancer.min.js"></script>

      </body>

      </html>




      package com.food42.servlet;

      import java.io.IOException;
      import java.io.PrintWriter;
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;

      import javax.servlet.RequestDispatcher;
      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;

      import org.apache.log4j.Logger;
      import com.food42.util.User;

      @WebServlet(name = "Login", urlPatterns = "/Login")
      public class LoginServlet extends HttpServlet
      private static final long serialVersionUID = 1L;

      static Logger logger = Logger.getLogger(LoginServlet.class);

      @Override
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException







      java xml jsp servlets java-ee






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 7:10









      Rathnayake

      3591416




      3591416










      asked Mar 8 at 7:18









      Valeria DRValeria DR

      12




      12






















          2 Answers
          2






          active

          oldest

          votes


















          0














          In a similar project I have, I do it this way,



          1 - I don't declare anything in the Servlet class, just have it like that,



          public class Margin extends HttpServlet ... 


          & I make all the Servlet declarations inside my web.xml,



          <servlet>
          <servlet-name>Margin</servlet-name>
          <servlet-class>gr.thebexperts.servlets.Margin</servlet-class>
          </servlet>
          <servlet-mapping>
          <servlet-name>Margin</servlet-name>
          <url-pattern>/Margin</url-pattern>
          </servlet-mapping>


          This is probably not related to your issue but you can try it in a similar way.



          2 - What is different though that maybe causes the issue is that you can try to place your login.jsp page at the same level as WEB-INF, meaning directly under /WebContent, it will probably work.



          Hope it helps!






          share|improve this answer























          • Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

            – Valeria DR
            Mar 9 at 7:40












          • @ValeriaDR Glad that you found the solution, well done!

            – dZ.
            Mar 9 at 12:21


















          0














          I managed to solve the problem.
          I'll post the solution maybe it helps someone with a similar kind of problem.



          I had to change my project directory structure.
          My problem was that i named my java-packages com.example.test (in my project com.food42.servlet) instead of creating a directory for com and in the com directory a directory named example and so on.



          Before:




          src
          ├── main
          │   ├── com.food42.database
          │   │   └── database.sql
          │   ├── com.food42.servlet
          │   │   ├── AuthenticationFilter.java
          │   │   ├── LoginServlet.java
          │   │   ├── LogoutServlet.java
          │   │   └── RegisterServlet.java
          │   ├── com.food42.servlet.errorhandler
          │   │   └── AppErrorHandler.java
          │   ├── com.food42.servlet.listeners
          │   │   └── AppContextListener.java
          │   └── com.food42.util
          │   ├── DBConnectionManager.java
          │   └── User.java
          └── test
          └── TestLoginFilter.java



          Afterwards:




          src
          ├── main
          │   └── java
          │   └── com
          │   └── food42
          │   ├── database
          │   │   └── database.sql
          │   ├── servlet
          │   │   ├── AuthenticationFilter.java
          │   │   ├── LoginServlet.java
          │   │   ├── LogoutServlet.java
          │   │   ├── RegisterServlet.java
          │   │   ├── errorhandler
          │   │   │   └── AppErrorHandler.java
          │   │   └── listeners
          │   │   └── AppContextListener.java
          │   └── util
          │   ├── DBConnectionManager.java
          │   └── User.java
          └── test
          └── TestLoginFilter.java



          Credit to my professor who helped me find out what the problem was =)



          Some images to better show my changes:




          Directory structure
          Deployment_Assembly
          Build_path_source
          Build_path_libraries







          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058471%2fjsp-servlet-http-status-404-not-found%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            In a similar project I have, I do it this way,



            1 - I don't declare anything in the Servlet class, just have it like that,



            public class Margin extends HttpServlet ... 


            & I make all the Servlet declarations inside my web.xml,



            <servlet>
            <servlet-name>Margin</servlet-name>
            <servlet-class>gr.thebexperts.servlets.Margin</servlet-class>
            </servlet>
            <servlet-mapping>
            <servlet-name>Margin</servlet-name>
            <url-pattern>/Margin</url-pattern>
            </servlet-mapping>


            This is probably not related to your issue but you can try it in a similar way.



            2 - What is different though that maybe causes the issue is that you can try to place your login.jsp page at the same level as WEB-INF, meaning directly under /WebContent, it will probably work.



            Hope it helps!






            share|improve this answer























            • Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

              – Valeria DR
              Mar 9 at 7:40












            • @ValeriaDR Glad that you found the solution, well done!

              – dZ.
              Mar 9 at 12:21















            0














            In a similar project I have, I do it this way,



            1 - I don't declare anything in the Servlet class, just have it like that,



            public class Margin extends HttpServlet ... 


            & I make all the Servlet declarations inside my web.xml,



            <servlet>
            <servlet-name>Margin</servlet-name>
            <servlet-class>gr.thebexperts.servlets.Margin</servlet-class>
            </servlet>
            <servlet-mapping>
            <servlet-name>Margin</servlet-name>
            <url-pattern>/Margin</url-pattern>
            </servlet-mapping>


            This is probably not related to your issue but you can try it in a similar way.



            2 - What is different though that maybe causes the issue is that you can try to place your login.jsp page at the same level as WEB-INF, meaning directly under /WebContent, it will probably work.



            Hope it helps!






            share|improve this answer























            • Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

              – Valeria DR
              Mar 9 at 7:40












            • @ValeriaDR Glad that you found the solution, well done!

              – dZ.
              Mar 9 at 12:21













            0












            0








            0







            In a similar project I have, I do it this way,



            1 - I don't declare anything in the Servlet class, just have it like that,



            public class Margin extends HttpServlet ... 


            & I make all the Servlet declarations inside my web.xml,



            <servlet>
            <servlet-name>Margin</servlet-name>
            <servlet-class>gr.thebexperts.servlets.Margin</servlet-class>
            </servlet>
            <servlet-mapping>
            <servlet-name>Margin</servlet-name>
            <url-pattern>/Margin</url-pattern>
            </servlet-mapping>


            This is probably not related to your issue but you can try it in a similar way.



            2 - What is different though that maybe causes the issue is that you can try to place your login.jsp page at the same level as WEB-INF, meaning directly under /WebContent, it will probably work.



            Hope it helps!






            share|improve this answer













            In a similar project I have, I do it this way,



            1 - I don't declare anything in the Servlet class, just have it like that,



            public class Margin extends HttpServlet ... 


            & I make all the Servlet declarations inside my web.xml,



            <servlet>
            <servlet-name>Margin</servlet-name>
            <servlet-class>gr.thebexperts.servlets.Margin</servlet-class>
            </servlet>
            <servlet-mapping>
            <servlet-name>Margin</servlet-name>
            <url-pattern>/Margin</url-pattern>
            </servlet-mapping>


            This is probably not related to your issue but you can try it in a similar way.



            2 - What is different though that maybe causes the issue is that you can try to place your login.jsp page at the same level as WEB-INF, meaning directly under /WebContent, it will probably work.



            Hope it helps!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 8 at 8:35









            dZ.dZ.

            345




            345












            • Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

              – Valeria DR
              Mar 9 at 7:40












            • @ValeriaDR Glad that you found the solution, well done!

              – dZ.
              Mar 9 at 12:21

















            • Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

              – Valeria DR
              Mar 9 at 7:40












            • @ValeriaDR Glad that you found the solution, well done!

              – dZ.
              Mar 9 at 12:21
















            Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

            – Valeria DR
            Mar 9 at 7:40






            Thank you for your help. Sadly the problem was my directory structure. I've posted the answer just now if you're interested =)

            – Valeria DR
            Mar 9 at 7:40














            @ValeriaDR Glad that you found the solution, well done!

            – dZ.
            Mar 9 at 12:21





            @ValeriaDR Glad that you found the solution, well done!

            – dZ.
            Mar 9 at 12:21













            0














            I managed to solve the problem.
            I'll post the solution maybe it helps someone with a similar kind of problem.



            I had to change my project directory structure.
            My problem was that i named my java-packages com.example.test (in my project com.food42.servlet) instead of creating a directory for com and in the com directory a directory named example and so on.



            Before:




            src
            ├── main
            │   ├── com.food42.database
            │   │   └── database.sql
            │   ├── com.food42.servlet
            │   │   ├── AuthenticationFilter.java
            │   │   ├── LoginServlet.java
            │   │   ├── LogoutServlet.java
            │   │   └── RegisterServlet.java
            │   ├── com.food42.servlet.errorhandler
            │   │   └── AppErrorHandler.java
            │   ├── com.food42.servlet.listeners
            │   │   └── AppContextListener.java
            │   └── com.food42.util
            │   ├── DBConnectionManager.java
            │   └── User.java
            └── test
            └── TestLoginFilter.java



            Afterwards:




            src
            ├── main
            │   └── java
            │   └── com
            │   └── food42
            │   ├── database
            │   │   └── database.sql
            │   ├── servlet
            │   │   ├── AuthenticationFilter.java
            │   │   ├── LoginServlet.java
            │   │   ├── LogoutServlet.java
            │   │   ├── RegisterServlet.java
            │   │   ├── errorhandler
            │   │   │   └── AppErrorHandler.java
            │   │   └── listeners
            │   │   └── AppContextListener.java
            │   └── util
            │   ├── DBConnectionManager.java
            │   └── User.java
            └── test
            └── TestLoginFilter.java



            Credit to my professor who helped me find out what the problem was =)



            Some images to better show my changes:




            Directory structure
            Deployment_Assembly
            Build_path_source
            Build_path_libraries







            share|improve this answer





























              0














              I managed to solve the problem.
              I'll post the solution maybe it helps someone with a similar kind of problem.



              I had to change my project directory structure.
              My problem was that i named my java-packages com.example.test (in my project com.food42.servlet) instead of creating a directory for com and in the com directory a directory named example and so on.



              Before:




              src
              ├── main
              │   ├── com.food42.database
              │   │   └── database.sql
              │   ├── com.food42.servlet
              │   │   ├── AuthenticationFilter.java
              │   │   ├── LoginServlet.java
              │   │   ├── LogoutServlet.java
              │   │   └── RegisterServlet.java
              │   ├── com.food42.servlet.errorhandler
              │   │   └── AppErrorHandler.java
              │   ├── com.food42.servlet.listeners
              │   │   └── AppContextListener.java
              │   └── com.food42.util
              │   ├── DBConnectionManager.java
              │   └── User.java
              └── test
              └── TestLoginFilter.java



              Afterwards:




              src
              ├── main
              │   └── java
              │   └── com
              │   └── food42
              │   ├── database
              │   │   └── database.sql
              │   ├── servlet
              │   │   ├── AuthenticationFilter.java
              │   │   ├── LoginServlet.java
              │   │   ├── LogoutServlet.java
              │   │   ├── RegisterServlet.java
              │   │   ├── errorhandler
              │   │   │   └── AppErrorHandler.java
              │   │   └── listeners
              │   │   └── AppContextListener.java
              │   └── util
              │   ├── DBConnectionManager.java
              │   └── User.java
              └── test
              └── TestLoginFilter.java



              Credit to my professor who helped me find out what the problem was =)



              Some images to better show my changes:




              Directory structure
              Deployment_Assembly
              Build_path_source
              Build_path_libraries







              share|improve this answer



























                0












                0








                0







                I managed to solve the problem.
                I'll post the solution maybe it helps someone with a similar kind of problem.



                I had to change my project directory structure.
                My problem was that i named my java-packages com.example.test (in my project com.food42.servlet) instead of creating a directory for com and in the com directory a directory named example and so on.



                Before:




                src
                ├── main
                │   ├── com.food42.database
                │   │   └── database.sql
                │   ├── com.food42.servlet
                │   │   ├── AuthenticationFilter.java
                │   │   ├── LoginServlet.java
                │   │   ├── LogoutServlet.java
                │   │   └── RegisterServlet.java
                │   ├── com.food42.servlet.errorhandler
                │   │   └── AppErrorHandler.java
                │   ├── com.food42.servlet.listeners
                │   │   └── AppContextListener.java
                │   └── com.food42.util
                │   ├── DBConnectionManager.java
                │   └── User.java
                └── test
                └── TestLoginFilter.java



                Afterwards:




                src
                ├── main
                │   └── java
                │   └── com
                │   └── food42
                │   ├── database
                │   │   └── database.sql
                │   ├── servlet
                │   │   ├── AuthenticationFilter.java
                │   │   ├── LoginServlet.java
                │   │   ├── LogoutServlet.java
                │   │   ├── RegisterServlet.java
                │   │   ├── errorhandler
                │   │   │   └── AppErrorHandler.java
                │   │   └── listeners
                │   │   └── AppContextListener.java
                │   └── util
                │   ├── DBConnectionManager.java
                │   └── User.java
                └── test
                └── TestLoginFilter.java



                Credit to my professor who helped me find out what the problem was =)



                Some images to better show my changes:




                Directory structure
                Deployment_Assembly
                Build_path_source
                Build_path_libraries







                share|improve this answer















                I managed to solve the problem.
                I'll post the solution maybe it helps someone with a similar kind of problem.



                I had to change my project directory structure.
                My problem was that i named my java-packages com.example.test (in my project com.food42.servlet) instead of creating a directory for com and in the com directory a directory named example and so on.



                Before:




                src
                ├── main
                │   ├── com.food42.database
                │   │   └── database.sql
                │   ├── com.food42.servlet
                │   │   ├── AuthenticationFilter.java
                │   │   ├── LoginServlet.java
                │   │   ├── LogoutServlet.java
                │   │   └── RegisterServlet.java
                │   ├── com.food42.servlet.errorhandler
                │   │   └── AppErrorHandler.java
                │   ├── com.food42.servlet.listeners
                │   │   └── AppContextListener.java
                │   └── com.food42.util
                │   ├── DBConnectionManager.java
                │   └── User.java
                └── test
                └── TestLoginFilter.java



                Afterwards:




                src
                ├── main
                │   └── java
                │   └── com
                │   └── food42
                │   ├── database
                │   │   └── database.sql
                │   ├── servlet
                │   │   ├── AuthenticationFilter.java
                │   │   ├── LoginServlet.java
                │   │   ├── LogoutServlet.java
                │   │   ├── RegisterServlet.java
                │   │   ├── errorhandler
                │   │   │   └── AppErrorHandler.java
                │   │   └── listeners
                │   │   └── AppContextListener.java
                │   └── util
                │   ├── DBConnectionManager.java
                │   └── User.java
                └── test
                └── TestLoginFilter.java



                Credit to my professor who helped me find out what the problem was =)



                Some images to better show my changes:




                Directory structure
                Deployment_Assembly
                Build_path_source
                Build_path_libraries








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 9 at 7:37

























                answered Mar 9 at 7:29









                Valeria DRValeria DR

                12




                12



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058471%2fjsp-servlet-http-status-404-not-found%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    1928 у кіно

                    Захаров Федір Захарович

                    Ель Греко