java ee - Accessing a JSP via a Servlet -
i learning java ee , i'm pretty new mvc development, thank in advance patience.
i'm trying write simple jsp accessible via servlet, getting 404 error when try reach following urls :
i don't see went wrong, or forgot write. appreciate in regard.
here project tree structure (eclipse):
here files have developed.
inscription.jsp
<%@ page pageencoding="utf-8" %> <!doctype html> <html> <head> <meta charset="utf-8" /> <title>inscription</title> <link type="text/css" rel="stylesheet" href="/inc/styles/css/form.css" /> </head> <body> <form method="get" action="inscription"> <fieldset> <legend>inscription</legend> <p>vous pouvez vous inscrire via ce formulaire.</p> <label for="email">adresse email <span class="requis">*</span></label> <input type="text" id="email" name="email" value="" size="20" maxlength="60" /> <br /> <label for="motdepasse">mot de passe <span class="requis">*</span> </label> <input type="password" id="motdepasse" name="motdepasse" value="" size="20" maxlength="20" /> <br /> <label for="confirmation">confirmation du mot de passe <span class="requis">*</span> </label> <input type="password" id="confirmation" name="confirmation" value="" size="20" maxlength="20" /> <br /> <label for="nom">nom d'utilisateur</label> <input type="text" id="nom" name="nom" value="" size="20" maxlength="20" /> <br /> <input type="submit" value="inscription" class="sanslabel" /> <br /> </fieldset> </form> </body> </html>
web.xml
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http:/'2fwww.w3.mrg/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>pro</display-name> <servlet> <servlet-name>inscription</servlet-name> <servlet-class>servlets.inscription</servlet-class> <init-param> <param-name>auteur</param-name> <param-value>imad</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>inscription</servlet-name> <url-pattern>/inscription</url-pattern> </servlet-mapping> </web-app>
inscription.java -the servlet
package servlets; import java.io.ioexception; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; public class inscription extends httpservlet { /** * uid */ private static final long serialversionuid = 7413041593835021978l; /** * path de la vue */ public static final string vue = "/web-inf/incription.jsp"; @override protected void doget( httpservletrequest req , httpservletresponse resp ) throws servletexception , ioexception { this.getservletcontext().getrequestdispatcher( vue ).forward( req , resp ); } }
here spelling mistake inscription.jsp
public static final string vue = "/web-inf/incription.jsp";
and in form action should try this:
action='/pro/inscription' or action='/inscription'
Comments
Post a Comment