Bonjour,
J'essaye de faire un test sur la gestion des session, voici mon problème,
j'ai une servlet et 2 JSP.
au premier appel, je fais appel à index.jsp, voici le code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <%@ 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>Insert title here</title>
</head>
<body>
<form name="form" method="post" action="/test/homePage?data=100">
<p>
Nom : <input type="text" name="nom">
Prénom : <input type="text" name="prenom">
</p>
<p>Commentaire :<br>
<textarea name="textarea" cols="50" rows="10"> </textarea><br>
<input type="submit" name="Submit" rows="5" value="Soumettre">
</p>
</form>
</body>
</html> |
après ça je recupère les données dans ma Servlet et je sauvegarde le nom et le prénom dans la session de cette façon :
session.setAttribute("nom", valeur);
,
puis je forward vert la deuxième JSP, voici le code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <%@ 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>Insert title here</title>
</head>
<body>
<form name="form" method="post" action="/test/homePage?data=100&appel=2">
<input type="submit" name="Submit" rows="5" value="Soumettre">
</form>
</body>
</html> |
puis je recupère les données dans la servlet,, mais je n'arrive pas à recupérer les données que j'ai mis dans la session lors de premier appel,,
D'avance Merci.
Partager