Affichage des données sur une page jsp
Bonsoir,
Je débute en struts et ejb et je voudrais récupérer des valeurs à partir de ma base et les afficher sur une page jsp dans des champs texte (pour pouvoir les modifier ultérieurement).
Voici ma classe AffichageAction:
Code:
1 2 3 4 5 6
| final Context context = new InitialContext ();
RefGenBeanRemote ref = (RefGenBeanRemote) context.lookup("RefGen");
List <ParametreGeneraux> tt=ref.afficherSociete();
System.out.println("affsocact Ville "+tt.get(0).getVilSoci());//ville
System.out.println("affsocact Ville "+tt.get(0).getLibSoci());//identification |
Ma page jsp:
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
| <html:form action="societe1">
<logic:present name="tt">
<table align="center">
<tr>
<td><bean:message key="societe.code" />*</td>
<td><html:text property="code" size="5"/></td>
<td><bean:message key="societe.identification" />*</td>
<td><html:text property="identification" size="40"/></td>
</tr>
<logic:iterate id="listesoc" name="tt">
<tr>
<td><bean:write name="societeForm" property="code"/></td>
<td><bean:write name="societeForm" property="identification"/></td>
</tr>
</logic:iterate>
<tr>
<td align="right"><html:submit property="submit" value="Valider"></html:submit></td>
</tr>
</table>
</logic:present>
</html:form> |
Avant d'ajouter l'itérateur, ça m'affichait dans la console les valeurs souhaitées. Je voudrais maintenant les afficher sur ma page, je crois qu'il y a quelque chose qui manque!
Je voudrais savoir également à quoi sert "setAttribute":
Code:
1 2 3 4
|
ServletContext s = request.getSession().getServletContext();
List<ParametreGeneraux> listesoc = (List<ParametreGeneraux>)s.getAttribute("tt");
s.setAttribute("listesoc", tt); |
Quand j'ai ajouté ces lignes rien n'a changé!!!
Merci