This is web.xml
<servlet>
<servlet-name>ClientServlet</servlet-name>
<servlet-class>ma.fstt.web.ClientServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ClientServlet</servlet-name>
<url-pattern>/client</url-pattern>
</servlet-mapping>
And this is the ClientServlet.java
package ma.fstt.web;
public class ClientServlet extends HttpServlet {
...
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getServletPath();
System.out.println(action);
try {
switch (action) {
case "/new":
showNewForm(request, response);
break;
...
default:
listClients(request, response);
break;
}
} catch (SQLException ex) {
throw new ServletException(ex);
}
}
...
}
I'm trying to access the showNewForm by http://localhost:8081/Atelier1/client/new and this error show up enter image description here
CodePudding user response:
Try @WebServlet("/client") instead of url-pattern in web
CodePudding user response:
try to change the url "/client" to something like "*.php"