Bonjour
jé choisi comme intitulé de mon sujet, le message qui me sort lorsque je deploie une petite application J2EE de test des tags display :
voila ma page JSP :
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
 
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.Vector" %>
<%@ page import="packTags.User" %>
<%@ page import="java.util.ArrayList" %>
 
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
 
    <title>MyJsp.jsp</title>
 
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
  </head>
 
  <body>
    This a struts page. <hr>
    <%
    	ArrayList a=new ArrayList();
    	//////////////////////
    	User user1=new User();
    	user1.setNom("aaa");
    	user1.setAge(18);
    	//////////////////////
    	User user2=new User();
    	user2.setNom("bbb");
    	user2.setAge(23);
    	/////////////////////////
    	a.add(user1);
    	a.add(user2);
    	pageContext.setAttribute("users",a);
    %>
 
    <display:table name="users" class="isis">
    	<display:column property="nom" title="Nom"/>
    	<display:column property="age" title="Age"/>    	
    </display:table>
 
  </body>
</html:html>
-------------------
et voila ma classe User:
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
 
package packTags;
 
public class User {
	private String nom;
	private int age;
	public void setNom(String n){
		nom=n;
	}
	public void setAge(int a){
		age=a;
	}
	public int getAge(){
		return age;
	}
	public String getNom(){
		return nom;
	}
}
----------------------------------------
Normalement ça doit m'afficher une table ds mapage JSP
mé il m'affiche au lieu du table le message Nothing found to display.