displaying 2-dimensional arrays in JSPs

champion's Avatar, Join Date: May 2007
Light Poster
NB: All code given is Java code

I have declared my variable as follows:

String [][] agent = new String[][];

I have populated the array successfully.

I now want to print the contents of my array side by side as agent[0][0] to give me an output like: Eddy 0.8 where Eddy is in the row and 0.8 is in the column.

Thank you guys!
msi_333's Avatar, Join Date: May 2007
Go4Expert Member
Now .
IF you have multi-D Array of Strings you can do the following .

Code:
 for(int i=0;i<arr.length ;i++)
        {
            System.out.print("| ");
            for(int j=0;j<arr[0].length;j++)
            {
           
                System.out.print(arr[i][j]+" ");
            }
            System.out.println("| ");
        }
champion's Avatar, Join Date: May 2007
Light Poster
i want to display the results in a jsp.

any suggestions?