title: Netbeans and glassfish HTTP ERROR 404
body: <p>I need your help. I had made a source code for a web appl but I have this error when I click on the "add" submit button and I have the same error on the others submit button. My source code is :</p>
  
  <p>filoptwxoinfo.jsp :</p>
  
  <pre><code> &lt;%-- 
      Document   : index
      Created on : 17 Δεκ 2012, 6:39:05 μμ
      Author     : Editor
  --%&gt;
  
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Πληροφορίες Φιλοπτώχου&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;table border="1"&gt;
          &lt;td&gt;&lt;a href="filoptwxoinfo.jsp"&gt;Μέλη Φιλοπτώχου&lt;/a&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href="./FullFiloptwxo.jsp"&gt;Σύνολο Φιλοπτώχου&lt;/a&gt;&lt;/td&gt;
      &lt;/table&gt;
      &lt;/br&gt;
  
      &lt;form action=".FiloptwxoServlet" method="POST"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Α.Φ.Μ. :&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="afm" value="${filoptwxo.afm}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;Όνομα :&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="name" value="${filoptwxo.name}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt; 
                  &lt;td&gt;Επώνυμο:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="lastname" value="${filoptwxo.lastname}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;Πατρώνυμο:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="fathername" value="${filoptwxo.fathername}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;Διεύθυνση Οικείας:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="address" value="${filoptwxo.address}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;Τηλέφωνο:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="number" value="${filoptwxo.number}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;  
                  &lt;td&gt;Μέλη Οικογενείας:&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" name="numberop" value="${filoptwxo.numberop}"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;&lt;input type="Submit" name="operation" value="Add" /&gt;
                                  &lt;input type="Submit" name="operation" value="Edit" /&gt;
                                  &lt;input type="Submit" name="operation" value="Delete" /&gt;
                                  &lt;input type="Submit" name="operation" value="Search" /&gt;
  
                          &lt;/tr&gt;
                  &lt;/table&gt;
          &lt;/form&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Fullfiloptwxo.jsp :</p>
  
  <pre><code> &lt;%-- 
          Document   : FullFiloptwxo
          Created on : Dec 17, 2012, 6:47:52 PM
          Author     : Editor
      --%&gt;
  
      &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
      &lt;%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
          &lt;head&gt;
              &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
              &lt;title&gt;Λίστα Μελών Φιλοπτώχου&lt;/title&gt;
          &lt;/head&gt;
          &lt;body&gt;
               &lt;table border="1"&gt;
              &lt;td&gt;&lt;a href="filoptwxoinfo.jsp"&gt;Μέλη Φιλοπτώχου&lt;/a&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a href="./FullFiloptwxo.jsp"&gt;Σύνολο Φιλοπτώχου&lt;/a&gt;&lt;/td&gt;
          &lt;/table&gt;
          &lt;br /&gt;
              &lt;h3&gt; Λίστα Μελών &lt;/h3&gt;
  
              &lt;table border="1"&gt;
                  &lt;th&gt; Α.Φ.Μ. &lt;/th&gt;
                  &lt;th&gt; Όνομα &lt;/th&gt; 
                  &lt;th&gt; Επώνυμο &lt;/th&gt;
                  &lt;th&gt; Πατρώνυμο &lt;/th&gt;
                  &lt;th&gt; Διεύθυνση Οικείας &lt;/th&gt;
                  &lt;th&gt; Τηλέφωνο &lt;/th&gt;
                  &lt;th&gt; Μέλη Οικογενείας &lt;/th&gt;
                  &lt;c:forEach items="${requestScope.list}" var="Filoptwxo"&gt;  
                      &lt;tr&gt;
                          &lt;td&gt;&lt;a href=".GetFiloptwxo?afm=${filoptwxo.afm}"&gt;${filoptwxo.afm}&lt;/a&gt;&lt;/td&gt;
                          &lt;td&gt;${filoptwxo.name}&lt;/td&gt;
                          &lt;td&gt;${filoptwxo.lastname}&lt;/td&gt;
                          &lt;td&gt;${filoptwxo.fathername}&lt;/td&gt;
                          &lt;td&gt;${filoptwxo.address}&lt;/td&gt; 
                          &lt;td&gt;${filoptwxo.phone}&lt;/td&gt;
                          &lt;td&gt;${filoptwxo.numberop}&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/c:forEach&gt;
  
              &lt;/table&gt;    
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Filoptwxo.java :</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package model;
  
  /**
   * @author Editor
   */
  public class Filoptwxo {
      private String afm;
      private String name;
      private String lastname;
      private String address;
      private String fathername;
      private String numberop;
      private String phone;
  
  
      public String getAfm() {
          return afm;
      }
  
      public void setAfm(String afm) {
          this.afm = afm;
      }
  
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getLastname() {
          return lastname;
      }
  
      public void setLastname(String lastname) {
          this.lastname = lastname;
      }
  
      public String getFathername() {
          return fathername;
      }
  
      public void setFathername(String fathername) {
          this.fathername = fathername;
      }
  
       public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      } 
  
      public String getPhone() {
          return phone;
      }
  
      public void setPhone(String phone) {
          this.phone = phone;
      }
  
       public String getNumberop() {
          return numberop;
      }
  
      public void setNumberop(String numberop) {
          this.numberop = numberop;
      }
  
      public Filoptwxo(String afm, String name, String lastname, String fathername, String address, String phone, String numberop ){
          this.afm = afm;
          this.name = name;
          this.lastname = lastname;
          this.fathername = fathername;
          this.address = address;
          this.numberop = numberop;
          this.phone = phone;
      }
      public Filoptwxo(){}
  }
  </code></pre>
  
  <p>FiloptwxoDAO.java :</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package model.ejb;
  
  import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.util.ArrayList;
  import javax.annotation.Resource;
  import javax.ejb.Stateless;
  import javax.sql.DataSource;
  import model.Filoptwxo;
  
  /**
   * @author Editor
   */
  @Stateless
  public class FiloptwxoDAO { 
      @Resource(name="jdbc/filoptwxoDB")
      private DataSource ds;
  
      public void addFiloptwxo (Filoptwxo filoptwxo) {
          String sql = "INSERT INTO FILOPTWXO VALUES('"+ filoptwxo.getAfm() +"', '"+ filoptwxo.getName() +"', '"+ filoptwxo.getLastname() +"', '"+ filoptwxo.getFathername() +"', '"+ filoptwxo.getAddress() +"', '"+ filoptwxo.getPhone() +"', '"+ filoptwxo.getNumberop() +"')";
          executeModifyQuery(sql);
      }
  
      public void editFiloptwxo (Filoptwxo filoptwxo) {
          String sql = "UPDATE FILOPTWXO SET NAME='" + filoptwxo.getName() +"', ADDRESS" + filoptwxo.getAddress() +"', LASTNAME" + filoptwxo.getLastname() +"', FATHERNAME" + filoptwxo.getFathername() +"', PHONE" + filoptwxo.getPhone() +"', NUMBEROP" + filoptwxo.getNumberop() +"' WHERE AFM='"+ filoptwxo.getAfm() +"'";
          executeModifyQuery(sql);
      }
  
      public void deleteFiloptwxo(Filoptwxo filoptwxo) {
          String sql = "DELETE FROM STUDENT WHERE AFM= '"+ filoptwxo.getAfm() + "'";
          executeModifyQuery(sql);
      }
  
        public Filoptwxo getFiloptwxo(String afm) {
          Filoptwxo filoptwxo = new Filoptwxo();
          String sql = "SELECT * FROM FILOPTWXO WHERE AFM='"+ afm+"'";
          System.out.println(sql);
          ResultSet rs = executeFetchQuery(sql);
          try {
              if (rs.next()){
                 filoptwxo.setAfm(rs.getString("AFM"));
                 filoptwxo.setName(rs.getString("NAME"));
                 filoptwxo.setLastname(rs.getString("LASTNAME"));
                 filoptwxo.setFathername(rs.getString("FATHERNAME"));
                 filoptwxo.setAddress(rs.getString("ADDRESS"));
                 filoptwxo.setPhone(rs.getString("PHONE"));
                 filoptwxo.setNumberop(rs.getString("NUMBEROP"));
              }
          } catch (Exception ex) {
              System.err.println("GS" + ex.getMessage());
          }
          return filoptwxo;
      }
  
      public ArrayList&lt;Filoptwxo&gt; getFullFiloptwxo() {
          ArrayList&lt;Filoptwxo&gt; list = new ArrayList&lt;Filoptwxo&gt;();
          String sql = "SELECT * FROM FILOPTWXO";
          ResultSet rs = executeFetchQuery(sql);
          try {
              while(rs.next()) {
                 Filoptwxo filoptwxo = new Filoptwxo();
                 filoptwxo.setAfm(rs.getString("AFM"));
                 filoptwxo.setName(rs.getString("NAME"));
                 filoptwxo.setLastname(rs.getString("LASTNAME"));
                 filoptwxo.setFathername(rs.getString("FATHERNAME"));
                 filoptwxo.setAddress(rs.getString("ADDRESS"));
                 filoptwxo.setPhone(rs.getString("PHONE"));
                 filoptwxo.setNumberop(rs.getString("NUMBEROP"));
                 list.add(filoptwxo);
              }
          } catch (SQLException ex) {
              System.err.println(ex.getMessage());
          }
          return list;
      }
  
      public void executeModifyQuery(String sql)  {
          try {
              Connection conn = ds.getConnection();
              conn.createStatement().execute(sql);
              conn.close();
          } catch (Exception e) {
              System.err.println(e.getMessage());
          }
      }  
  
       public ResultSet executeFetchQuery(String sql)  {
           ResultSet rs = null;
           try {
              Connection conn = ds.getConnection();
              rs = conn.createStatement().executeQuery(sql);
              conn.close();
          } catch (Exception e) {
              System.err.println(e.getMessage());
          }
          return rs;
      }
  
  }
  </code></pre>
  
  <p>FiloptwxoServlet.java :</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package controller;
  
  import java.io.IOException;
  import javax.ejb.EJB;
  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 model.Filoptwxo;
  import model.ejb.FiloptwxoDAO;
  
  /**
   * @author Editor
   */
  @WebServlet(name = "FiloptwxoServlet", urlPatterns = {"/FiloptwxoServlet"})
  public class FiloptwxoServlet extends HttpServlet {
      @EJB private FiloptwxoDAO filoptwxoDAO;
  
      /**
       * Processes requests for both HTTP
       * &lt;code&gt;GET&lt;/code&gt; and
       * &lt;code&gt;POST&lt;/code&gt; methods.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  
      String afm = request.getParameter ("afm");
      String name = request.getParameter ("name");
      String lastname = request.getParameter ("lastname");
      String fathername = request.getParameter ("fathername");
      String address = request.getParameter ("address");
      String phone = request.getParameter ("phone");
      String numberop = request.getParameter ("numberop");
      String operation = request.getParameter ("operation");
  
      Filoptwxo filoptwxo = new Filoptwxo(afm, name, lastname, fathername, address, phone, numberop);
  
      if (operation.equalsIgnoreCase("Add")) {
          filoptwxoDAO.addFiloptwxo(filoptwxo);
          request.setAttribute("filoptwxo", filoptwxo);
      } else if (operation.equalsIgnoreCase("Edit")) {
          filoptwxoDAO.editFiloptwxo(filoptwxo);
          Filoptwxo searchedFiloptwxo = filoptwxoDAO.getFiloptwxo(afm);
          request.setAttribute("filoptwxo", searchedFiloptwxo);       
  
      } else if (operation.equalsIgnoreCase("Delete")) {
          filoptwxoDAO.deleteFiloptwxo(filoptwxo);
      } else if (operation.equalsIgnoreCase("Search")) {
          Filoptwxo searchedFiloptwxo = filoptwxoDAO.getFiloptwxo(afm);
          request.setAttribute("filoptwxo", searchedFiloptwxo);
      }
      request.getRequestDispatcher("filoptwxoinfo.jsp").forward(request, response);    
   }
  
  
      // &lt;editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."&gt;
      /**
       * Handles the HTTP
       * &lt;code&gt;GET&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Handles the HTTP
       * &lt;code&gt;POST&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Returns a short description of the servlet.
       *
       * @return a String containing servlet description
       */
      @Override
      public String getServletInfo() {
          return "Short description";
      }// &lt;/editor-fold&gt;
  }
  </code></pre>
  
  <p>FullFiloptwxo.java :</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package controller;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import javax.ejb.EJB;
  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 model.Filoptwxo;
  import model.ejb.FiloptwxoDAO;
  
  /**
   * @author Editor
   */
  @WebServlet(name = "FullFiloptwxo", urlPatterns = {"/FullFiloptwxo"})
  public class FullFiloptwxo extends HttpServlet {
      @EJB private FiloptwxoDAO filoptwxoDAO;
      /**
       * Processes requests for both HTTP
       * &lt;code&gt;GET&lt;/code&gt; and
       * &lt;code&gt;POST&lt;/code&gt; methods.
       * 
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
  
         ArrayList&lt;Filoptwxo&gt; list = filoptwxoDAO.getFullFiloptwxo();
         request.setAttribute("list", list);
         request.getRequestDispatcher("FullFiloptwxo.jsp").forward(request, response);
      }
  
      // &lt;editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."&gt;
      /**
       * Handles the HTTP
       * &lt;code&gt;GET&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Handles the HTTP
       * &lt;code&gt;POST&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Returns a short description of the servlet.
       *
       * @return a String containing servlet description
       */
      @Override
      public String getServletInfo() {
          return "Short description";
      }// &lt;/editor-fold&gt;
  }
  </code></pre>
  
  <p>GetFiloptwxo.java :</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package controller;
  
  import java.io.IOException;
  import javax.ejb.EJB;
  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 model.Filoptwxo;
  import model.ejb.FiloptwxoDAO;
  
  /**
   * @author Editor
   */
  @WebServlet(name = "GetFiloptwxo", urlPatterns = {"/GetFiloptwxo"})
  public class GetFiloptwxo extends HttpServlet {
      @EJB private FiloptwxoDAO filoptwxoDAO;
      /**
       * Processes requests for both HTTP 
       * &lt;code&gt;GET&lt;/code&gt; and
       * &lt;code&gt;POST&lt;/code&gt; methods.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      protected void processRequest(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
         String afm = request.getParameter("afm");
         Filoptwxo filoptwxo = filoptwxoDAO.getFiloptwxo(afm);
         request.setAttribute("filoptwxo", filoptwxo);
         request.getRequestDispatcher("filoptwxoinfo.jsp").forward(request, response);
      }
  
      // &lt;editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."&gt;
      /**
       * Handles the HTTP
       * &lt;code&gt;GET&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Handles the HTTP
       * &lt;code&gt;POST&lt;/code&gt; method.
       *
       * @param request servlet request
       * @param response servlet response
       * @throws ServletException if a servlet-specific error occurs
       * @throws IOException if an I/O error occurs
       */
      @Override
      protected void doPost(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          processRequest(request, response);
      }
  
      /**
       * Returns a short description of the servlet.
       *
       * @return a String containing servlet description
       */
      @Override
      public String getServletInfo() {
          return "Short description";
      }// &lt;/editor-fold&gt;
  }
  </code></pre>
  
  <p>web-xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;filoptwxoinfo.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>This was the source code which I used but I have the problem with HTTP ERROR 404, I don't know what else I must do... I am trying to find a solution 2 days now so this is the reason that I wrote the whole code. </p>