onjour,
je viens de creer un petit exemple d'authentification;ou la page welcomAdmin.jsp va envoyer les donnees du formulaire au servlet "adminVaidation.java".
voila le code de la jsp:
et voila le web.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Bienvenue au console d'administration</title> </head> <body> <br/> <br/> <br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <center><table style="background-color: grey; border:1px solid black; font:italic ; font-size:150%;"> <tr> <form method="POST" action="/src/adminValidation"> <td>Login </td><td><input type="text" size="20" name="firstname"></td> </tr> <tr> <td>password </td><td><input type="text" size="20" name="lastname"></td> </tr> <tr> <td><input type="Submit" ></td> </tr> </form> </table></center> </body> </html>
la servlet est sous 'src' dans le package com.asea
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name> asea</display-name> <servlet> <description> </description> <display-name> adminValidation</display-name> <servlet-name>adminValidation</servlet-name> <servlet-class> com.asea.adminValidation</servlet-class> </servlet> <servlet-mapping> <servlet-name>adminValidation</servlet-name> <url-pattern>/adminValidation</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
les JSPs sont sous webContent/webINF/jsp
cependaant quand je click sur envouer je recoit le msg suivant:
La ressource demandée (/src/adminValidation) n'est pas disponible.
et j'aurait l'URL suivant:http://localhost:8080/src/adminValidation
qq peux m'aider
merci
Partager