Note that there are some explanatory texts on larger screens.

plurals
  1. POFirst JSP page--Using 2D Array--Page is not populating
    text
    copied!<p>Greetings,</p> <p>I'm attempting to write my first Java Bean + JSP page from scratch. However, I'm using a 2D array which is populated with arbitrary values, and I'm now getting an exception when I run the JSP saying that the array property cannot be found:</p> <pre><code>JSP Exception: javax.el.PropertyNotFoundException: Property 'utilTableVals' not found on type diskUtil.tester </code></pre> <p>Here is my bean code:</p> <pre><code>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 &lt; du1.utilTableVals.length; r++) { for(int c = 0 ; c &lt; 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></pre> <p>My JSP Code is here:</p> <pre><code>&lt;%@ page contentType="text/html" %&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;hmtl&gt; &lt;head&gt; &lt;title&gt;Disk Utilization Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;DISK UTILZATION REPORT&lt;/h1&gt; &lt;br&gt; &lt;jsp:useBean id="diskUtilData" scope="request" class="diskUtil.tester" /&gt; &lt;table&gt; &lt;c:forEach var="celldata" items="${diskUtilData.utilTableVals}"&gt; &lt;tr&gt; &lt;c:forEach var="col" items="${celldata}"&gt; &lt;td&gt; &lt;c:out value="${col}" /&gt; ${col} &lt;p&gt;hello&lt;/p&gt; &lt;/td&gt; &lt;/c:forEach&gt; &lt;/c:forEach&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Could someone please have a look? Thanks in advance.</p> <p>-TU</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload