Non riesco ad accedere al mio servlet che chiamo con un modulo. Ho controllato l'arborescenza, web.xml e il modulo, ma non riesco a vedere alcun problema. Uso Eclipse con un "progetto dinamico web".Tomcat dà 404 quando chiamo il mio servlet
c'è la mia arborescence:
mio web.xml:
<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Z-ProjetJ2EE</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<servlet-name>CommandeServlet</servlet-name>
<servlet-class>controleur.CommandeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CommandeServlet</servlet-name>
<url-pattern>/urlCommandeServ</url-pattern>
</servlet-mapping>
</web-app>
La mia forma (ho provato l'URL completo, ma non ha le opere):
<form action="/urlCommandeServ" method="post">
E il mio servlet:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String cat = request.getParameter("categorie");
Float prix = Float.parseFloat(request.getParameter("prix"));
response.sendRedirect("CreerCommande?cat=" + cat+"&prix="+prix);
Non ho avuto alcun errore in eclissi e la cartella di registro in tomcat è vuota. Potresti aiutarmi ?
EDIT:
C'è il mio errore:
Io sono d'accordo per le risposte circa il mio errore sul response.sendRedirect, ma questo non è il vero soggetto del mio errore :) Anche se cancella tutto il mio codice su doPost, ho questo errore, invece di una pagina bianca.
Ahahah è sempre così, solo un taglio, grazie! – toshiro92