3.0 beta 2

JSP Example?

Is there an example showing how to display a Grid from within a JSP? I ask because I don't see anything displayed in my JSP. If I place the script statements inside an html page it does display properly.
May 24,
I found the solution in this forum. It was related to a table with a grid inside of it.
May 24,
I am desing webpage which use JSP, I have a example about JSP for you.

<%@ page  language="java" import="java.sql.*"  %>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="control/runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" >
<script src="control/runtime/lib/grid.js"></script>
<script src="control/patches/paging1.js"></script>
<style type="text/css">
        .active-controls-grid {height:80%; width:100%; font:Arial, Helvetica, sans-serif; background:background-color:#FFFFFF;}
        .active-column-0 {width:40pt; text-align:center; background-color:#FFFFCC;}
        .active-column-1 {width: 110pt; background-color:#CCFFFF;}
        .active-column-2 {width: 60pt; text-align:center; background-color:#FFFFCC;}		
        .active-column-3 {width: 100pt; text-align:center; background-color:#CCFFFF;}
        .active-column-4 {width: 100pt;}		
        .active-column-5 {width: 100pt; text-align:center; background-color:#CCFFFF;}
        .active-grid-column {border-right: 1px solid black;}
        .active-grid-row {border-bottom: 1px solid black;}
        .active-templates-header{font-weight:bold; color:green; text-align:center;}		

        Class.forName("com.mysql.jdbc.Driver");//connect driver
    catch(ClassNotFoundException ce){

    boolean flag = false;
    String datagrid = "var myData=[\n";
                String sConnect = "jdbc:mysql://localhost/YourDB";//I am using MySQL database
                String sUserName = ""; //you define ex: "root"
                String sPassword="";//you define ex: "1234567".. ect 
        Connection connect = DriverManager.getConnection(sConnect, sUserNam, sPassword);
        ResultSet rs = null;
        Statement st = connect.createStatement();
        rs = st.executeQuery("SELECT * FROM YOURTABLE");
                flag = true;
                datagrid += "[\""+rs.getInt(1)+"\",\""+rs.getString(2)+"\",\""+rs.getString(3)+"\",\""+rs.getString(4)+"\",\""+rs.getString(5)+"\",\""+rs.getString(6)+"\"]\n";
                datagrid += ",[\""+rs.getInt(1)+"\",\""+rs.getString(2)+"\",\""+rs.getString(3)+"\",\""+rs.getString(4)+"\",\""+rs.getString(5)+"\",\""+rs.getString(6)+"\"]\n";
        datagrid += "];\n";
    catch(SQLException se){
var myTitle=["Column 1", "Column 2", "Column 3", "Column 4", "Column 5", "Column 6"];
<%=datagrid %>

var obj = new Active.Controls.Grid;
var row = new Active.Templates.Row; //add double click event
row.setEvent("ondblclick", function(){this.action("myAction")}); 
obj.setTemplate("row", row); 
obj.setModel("row", new Active.Rows.Page);
obj.setProperty("row/count", myData.length-1);//(myData.length-1) is total rows
obj.setProperty("column/count", 6);
obj.setProperty("data/text", function(i, j){return myData[i][j]});
obj.setProperty("column/texts", myTitle);
obj.setProperty("row/pageSize", 25);

Ns.Thinh (VietNam)
December 16,


I used this codings. But I got output only undefined.
Why it is coming like this? What should i do?

If anybody find this solution, Plz send me to the following id:
March 15,
Hi frnds actaully im creating one apllication form,i want to add image and i want 2 make it somewat attractive..........can u help me plz

my mail id is s1c9o8r4p2i7o@gmail.com
October 6,
Hi, can we use 2 dimensional arrays(String[row][col]) for the grid control?
Would really appreciate it if anyone can post a sample.

Thank you.

October 8,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.