how to convert my jsp active widget to struts tag ???
hi,
this is my .jsp code to show active widget :
and now, I want to use the grid using struts,
which tag that I need to change???
thanks.
Kahlil
this is my .jsp code to show active widget :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" import="java.sql.*" %>
<html>
<head>
<title>Tes Grid</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-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;}
</style>
</head>
<%
try{
Class.forName("com.mysql.jdbc.Driver");//connect driver
}
catch(ClassNotFoundException ce){
out.print(ce.getMessage());
}
%>
<body>
<%
boolean flag = false;
String datagrid = "var myData=[\n";
String sConnect = "jdbc:mysql://localhost:3306/petclinic";//I am using MySQL database
String sUserName = "root"; //you define ex: "root"
String sPassword="praweda";//you define ex: "1234567".. ect
try{
Connection connect = DriverManager.getConnection(sConnect, sUserName, sPassword);
ResultSet rs = null;
Statement st = connect.createStatement();
rs = st.executeQuery("SELECT * FROM visits");
while(rs.next()){
if(!flag){
flag = true;
datagrid += "[\""+rs.getInt(1)+"\",\""+rs.getString(2)+"\",\""+rs.getString(3)+"\",\""+rs.getString(4)+"\"]\n";
}
else{
datagrid += ",[\""+rs.getInt(1)+"\",\""+rs.getString(2)+"\",\""+rs.getString(3)+"\",\""+rs.getString(4)+"\"]\n";
}
}
datagrid += "];\n";
rs.close();
st.close();
connect.close();
}
catch(SQLException se){
out.print(se.getMessage());
}
%>
<script>
var myTitle=["Column 1", "Column 2", "Column 3", "Column 4"];
<%=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.setColumnHeaderHeight(25);
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);
document.write(obj);
</script>
</body>
</html>
and now, I want to use the grid using struts,
which tag that I need to change???
thanks.
Kahlil
Mr.K
November 22,