Problème d'initialisation d'un champs
Bonjour,
J'essaye de tester ma page JSP, mais je n'arrive pas a initialiser mes champs
Code:
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <%@ 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>Formulaire</title>
</head>
<body>
<%
System.out.println("ici");
//au debbeugueur je passe bien par la, mais quand j'affiche mes champs dans le formulaire, ils sont vides.
session.setAttribute("nom","Tintin");
session.setAttribute("age","30");
request.setAttribute("urlAction","main");
%>
<%
String nom = (String)session.getAttribute("nom");
String age = (String)session.getAttribute("age");
String urlAction = (String)request.getAttribute("urlAction");
%>
<center>
<h1>Formulaire</h1>
<form methode = "post" action ="<%=urlAction%>">
<table>
<tr>
<td>Nom</td>
<td><input type = "text" size ="20" name ="NOM" value =""/></td>
</tr>
<tr>
<td>Age</td>
<td><input type = "text" size ="10" name ="AGE" value =""/></td>
</tr>
</table>
<input type = "submit" value = "OK"/>
<input type = "reset" value = "RETABLIR"/>
<input type = "button" value = "EFFACER"/>
<input type = "hidden" name ="action" value= "validationFormulaire"/>
</form>
</center>
</body>
</html> |