Hi,
I want to use a java.sql.ResultSet as datasource to my webgrid. I see that there is a ResultSetDataModel provided for use. I tried creating one using the result set I have but did not get any success.
Can anyone please provide me a sample code to use the resultset as a data source. Thanks in advance.
faces-config.xml---------------------------------<faces-config><managed-bean> <managed-bean-name>Test</managed-bean-name> <managed-bean-class>MyPackage.Test.DataTest</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>
</faces-config>
faces-config.xml---------------------------------
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config><managed-bean> <managed-bean-name>Test</managed-bean-name> <managed-bean-class>MyPackage.Test.DataTest</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>
index.jsp----------------------------------..<f:view> <h:form> <h:panelGroup styleClass="main"> <%-- TITLE --%> <h:outputText styleClass="title" value="WebGrid Sample" /> <h:panelGroup styleClass="section">
<ig:gridView dataSource="#{Test.employees}" pageSize="10"> <f:facet name="header"> <h:outputText value="Employee List" /> </f:facet> <ig:column> <f:facet name="header"> <h:outputText value="First Name" /> </f:facet> <h:outputText value="#{DATA_ROW.Name}" /> </ig:column> <ig:column> <f:facet name="header"> <h:outputText value="Phone Number" /> </f:facet> <h:outputText value="#{DATA_ROW.Phone}" /> </ig:column></ig:gridView>
</h:panelGroup> </h:panelGroup> </h:form></f:view>....
index.jsp----------------------------------
<%@ page contentType="text/html" language="java"%><%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%><%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%><%@ taglib prefix="ig" uri="http://es.infragistics.com/faces/netadvantage"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>Infragistics NetAdvantage For Java Server Faces - Demo</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="description" content="Infragistics NetAdvantage for Java Server Faces - Demo"><link href="../../resources/default.css" rel="stylesheet" type="text/css"></head><body class="rightPanel"><f:view> <h:form> <h:panelGroup styleClass="main"> <%-- TITLE --%> <h:outputText styleClass="title" value="WebGrid Sample" /> <h:panelGroup styleClass="section">
</h:panelGroup> </h:panelGroup> </h:form></f:view></body></html>
DataTest.java------------------------------------
package MyPackage.Test;
import javax.faces.model.ResultSetDataModel;
public class DataTest {
protected ResultSetDataModel rs =null;
public ResultSetDataModel getEmployees() {
rs= DAO.getEmployees(); return rs; }
}