adavey
08-17-2006, 06:35 AM
Hi,
I'm new to OpenLaszlo and I'm trying to build a simple grid based on some data from my Oracle database. However, it appears that the grid will only display if the number of records in the result set are 26 or less. Otherwise, the grid component is invisible.
My code is based on what I have found in the documentation.
My jsp file:
<%@ page import="java.sql.*"%>
<client>
<%
Connection connection = null;
try {
Class.forName("oracle.jdbc.OracleDriver"); // 1
connection = DriverManager.getConnection
("jdbc:oracle:thin:@mydb:1521:service","adavey","xxx"); // 2
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select client_id, code, name from ag_client where
bus_unit_id = 9 and rownum <= 27");
while (rs.next()) {
%>
<record
id="<%= rs.getString("client_id")%>"
code="<%= rs.getString("code")%>"
name="<%= rs.getString("name")%>"
/>
<%
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
}
}
%>
</client>
My lzx file:
<canvas bgcolor="#D4D0C8">
<dataset name="clients" src="clients.jsp" request="true" type="http"/>
<grid height="200" datapath="clients:/client" contentdatapath="record">
<gridtext editable="false" datapath="@id">Id</gridtext>
<gridtext datapath="@code">Code</gridtext>
<gridtext datapath="@name">Name</gridtext>
</grid>
</canvas>
This code fails to display anything. However, if I call the jsp directly, I do see the correct number of records. Changing '... and rownum <= 27' to '...and rownum <=26' above does work in Laszlo. Even removing the 'and rownum <= n' predicate, which returns ~150 records works perfectly when calling the jsp page directly, but not for the grid component.
I am running OpenLaszlo v3.3.3 on Windows XP.
Any advice would certainly be appreciated.
Thanks,
Alan
I'm new to OpenLaszlo and I'm trying to build a simple grid based on some data from my Oracle database. However, it appears that the grid will only display if the number of records in the result set are 26 or less. Otherwise, the grid component is invisible.
My code is based on what I have found in the documentation.
My jsp file:
<%@ page import="java.sql.*"%>
<client>
<%
Connection connection = null;
try {
Class.forName("oracle.jdbc.OracleDriver"); // 1
connection = DriverManager.getConnection
("jdbc:oracle:thin:@mydb:1521:service","adavey","xxx"); // 2
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select client_id, code, name from ag_client where
bus_unit_id = 9 and rownum <= 27");
while (rs.next()) {
%>
<record
id="<%= rs.getString("client_id")%>"
code="<%= rs.getString("code")%>"
name="<%= rs.getString("name")%>"
/>
<%
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
}
}
%>
</client>
My lzx file:
<canvas bgcolor="#D4D0C8">
<dataset name="clients" src="clients.jsp" request="true" type="http"/>
<grid height="200" datapath="clients:/client" contentdatapath="record">
<gridtext editable="false" datapath="@id">Id</gridtext>
<gridtext datapath="@code">Code</gridtext>
<gridtext datapath="@name">Name</gridtext>
</grid>
</canvas>
This code fails to display anything. However, if I call the jsp directly, I do see the correct number of records. Changing '... and rownum <= 27' to '...and rownum <=26' above does work in Laszlo. Even removing the 'and rownum <= n' predicate, which returns ~150 records works perfectly when calling the jsp page directly, but not for the grid component.
I am running OpenLaszlo v3.3.3 on Windows XP.
Any advice would certainly be appreciated.
Thanks,
Alan