Salutations,Première page JSP - Utilisation de la matrice 2D - La page ne se remplit pas
Je tente d'écrire ma première page Java Bean + JSP à partir de zéro. Cependant, j'utilise un tableau 2D qui est rempli avec des valeurs arbitraires, et je suis maintenant faire une exception quand je lance la JSP disant que la propriété de tableau ne peut pas être trouvé:
JSP Exception: javax.el.PropertyNotFoundException: Property 'utilTableVals' not found on type diskUtil.tester
Voici mon code de haricot :
package diskUtil;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.*;
import java.lang.*;
import java.io.*;
public class tester{
//public String [][] utilTableVals;
String [][] utilTableVals = new String[20][20];
/***
bean's properties accessor
***/
/*public String[][] getUtilTableVals() {
return utilTableVals;
}*/
public static String[][] getUtilTableVals()throws Exception{
tester du1 = new tester();
//String [][] utilTableVals = new String[20][20];
int i=0;
int j=0;
int row=0;
int col=0;
int result=0;
for(int r = 0; r < du1.utilTableVals.length; r++)
{
for(int c = 0 ; c < du1.utilTableVals[r].length; c++)
{
result = r+c;
du1.utilTableVals[r][c]=Integer.toString(result);
//System.out.print(" " + utilTableVals[r][c]);
}
}
return du1.utilTableVals;
}//end getUtilTableVals
code Ma JSP est ici:
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<hmtl>
<head>
<title>Disk Utilization Page</title>
</head>
<body>
<h1>DISK UTILZATION REPORT</h1>
<br>
<jsp:useBean id="diskUtilData" scope="request" class="diskUtil.tester" />
<table>
<c:forEach var="celldata" items="${diskUtilData.utilTableVals}">
<tr>
<c:forEach var="col" items="${celldata}">
<td>
<c:out value="${col}" />
${col}
<p>hello</p>
</td>
</c:forEach>
</c:forEach>
</tr>
</table>
</body>
</html>
quelqu'un pourrait-il s'il vous plaît jeter un oeil? Merci d'avance.
-TU
Merci à tous. Je l'ai eu le travail! –