• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

database help

Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am unable to display all the data present in the database in a table form.only the first row is displayed .the remaining four are not displayed.
here is the code

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
<h:dataTable value="#{productBean.result}" var="item" cellpadding="10px" cellspacing="0">
<h:selectOneRadio id="radioButton#{product.id}">
<f:selectItem itemValue="b1" itemLabel="" />

<f:facet name="header">Product name</f:facet>
<f:facet name="header">Product link</f:facet>

<h:commandButton value="submit" action=""></h:commandButton>

* To change this template, choose Tools | Templates
* and open the template in the editor.
package Product;

import java.awt.Container;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.annotation.Resource;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.sql.DataSource;
import javax.sql.rowset.CachedRowSet;
import javax.swing.JButton;
import test.NewWebService;

* @author ppk5032
public class ProductBean implements Serializable

private String product;
private String image;
DataSource dataSource;

public String getImage() {
return image;

public void setImage(String image) {
this.image = image;

public String getProduct() {
return product;

public void setProduct(String product) {
this.product = product;

public ResultSet getResult() throws SQLException
System.out.println("******* in get result");

if (dataSource == null)
{System.out.println("******* inside datasource");
throw new SQLException("Unable to obtain DataSource");
System.out.println("******* out get result");
Connection connection = dataSource.getConnection();

if (connection == null)
{System.out.println("*no datasource connection");
throw new SQLException("Unable to connect to the DataSource");
try {
System.out.println("inside try");

PreparedStatement statment = connection.prepareStatement("SELECT Products, Image_links FROM website");

ResultSet rs = statment.executeQuery();

CachedRowSet rowSet = new com.sun.rowset.CachedRowSetImpl();


return rowSet;

} finally {


can any one tell me what is the problem here?thanks..!

    Bookmark Topic Watch Topic
  • New Topic