Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSF-Questions how to display database data in jsf page
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


srikala
how to display database data in jsf page
1 Answer(s)      6 years and 2 months ago
Posted in : Java Server Faces Questions



Advertisement
View Answers

October 29, 2008 at 12:50 PM


Hi friend,

Some step to be member to solve the problem.

1.First visit to link :

http://www.roseindia.net/jsf/dataTable.shtml

2.Do some changes in "TableBean.java" class :

package roseindia;
import java.sql.*;
import java.util.*;
public class TableBean {

Connection con ;
Statement ps;
ResultSet rs;
private List perInfoAll = new ArrayList();

public List getperInfoAll() {
int i = 0;
try
{

Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/userdetails","root","root";);
ps = con.createStatement();
rs = ps.executeQuery("select * from userlogin");
while(rs.next())
{
perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2)));
i++;

}

}
catch (Exception e)
{
System.out.println("Error Data : " + e.getMessage());
}
return perInfoAll;
}



public class perInfo {

String uname;
String password;


public perInfo(String uname, String password) {
this.uname = uname;
this.password = password;

}

public String getUname() {
return uname;
}

public String getPassword() {
return password;
}

}

}

"faces-config.xml"

<managed-bean>
<managed-bean-name>item</managed-bean-name>
<managed-bean-class>roseindia.TableBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

"data.jsp"

<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>

<f:view><html><body>
<h:form>
<br><br><br>
<h:dataTable id="dt1" value="#{item1.perInfoAll}" var="item" bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3" first="0" rows="2" width="50%" dir="LTR" frame="hsides" rules="all" summary="This is a JSF code to create dataTable." >

<f:facet name="header">
<h:outputText value="This is 'dataTable' demo" />
</f:facet>

<h:column>
<f:facet name="header">
<h:outputText value="uname" />
</f:facet>
<h:outputText value="#{item.uname}"></h:outputText>
</h:column>

<h:column>
<f:facet name="header">
<h:outputText value="password"/>
</f:facet>
<h:outputText value="#{item.password}"></h:outputText>
</h:column>

<f:facet name="footer">
<h:outputText value="The End" />
</f:facet>

</h:dataTable><br>

</h:form>
</body></html></f:view>

Thanks


Related Tutorials/Questions & Answers:
how to display database data in jsf page - Java Server Faces Questions
how to display database data in jsf page  Hi, i created tables in database,now i need to display the tables in jsf page.Means i have to get the deatils from database and i need to display in jsf.Please tell me the procedure
how to get the data from database&how to display the database data in jsf - Java Server Faces Questions
how to get the data from database&how to display the database data in jsf  Hi, 1.how to get the data from database. 2.how to display the database... and to display the data from database in jsf visit to : http://www.roseindia.net/jsf
Advertisements
Display Data from Database in JSF Application
Display Data from Database in JSF Application  ... data from database in JSF application. Developing JSF  Application In this section, we are going to display data from database in JSF based web
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
display data from a table in Access Database in a HTML page
display data from a table in Access Database in a HTML page  how to display data from a table in Access Database in a HTML page in a Java Program
SEARCHING THE DATA FROM DATABASE AND DISPLAY THE SEARCHED DATA IN HTML PAGE
SEARCHING THE DATA FROM DATABASE AND DISPLAY THE SEARCHED DATA IN HTML PAGE  pls help me....in this i want to search books from the database...\htdocs\project\opac1.php on line 10 HERE IS MY CODE my html page is <
how to display data from jsp file into database
how to display data from jsp file into database  this is a jsp file...+",'"+email+"')"); out.println("Data is successfully inserted into database... to com.mysql.jdbc.Statement please help me with it. thanks <%@ page language="java
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
How to display data from database in a TableView
How to display data from database in a TableView  I need to populate a TableView (JavaFx) with database items. I designed the TableView in JavaFx... at this. The classes: This is the Class that creates the database data object: import
how to display image and text in single jsp page from the mysql database
how to display image and text in single jsp page from the mysql database  hello please help me to display the image and text in single jsp page from mysql database if have any reference code please send me Thanks in advance
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page ... the data from this .properties file and display it in table format. Ex:by using... = DEDCHGG_PWDP and goes on... I have to create a jsp page to show these data
how to make drop down list in JSF & fetch data Item from database
how to make drop down list in JSF & fetch data Item from database  how to make drop down list in JSF & fetch data Item from database
how to display data from database according to entered value in search field
how to display data from database according to entered value in search.../jsp/jstl/sql"%> <%@page import="java.sql.*"%> <%@page...; <%@page import="java.sql.*"%> <%@page contentType="text/html
How to display nested ArrayList in JSF
to display it in jsf but i dont know how and i am getting mad. I have nested...How to display nested ArrayList in JSF  I have a class... is an ArrayList<ArrayList<String[]>> arrPartners I want to display it in jsf
How to display data from database in a TableView via Hibernate
How to display data from database in a TableView via Hibernate  I need to populate a TableView (JavaFx) with database items. I designed the TableView... at this. The classes: This is the Class that creates the database data object
Display Data from Database in JSP
; <html> <head> <title>display data from...;To display all the data from the table click here...</h2></TD>..._to_database_query.jsp' in address bar of browser and run. This page has a link
How we delete a data of database from front end jsp page
How we delete a data of database from front end jsp page   I make a website and featch a data from data base and now i want that a delete button put in front of a featched data and when i clicked on this button then the data
how to display data in excel sheet?
how to display data in excel sheet?  According to the user Id,some links will be generated from the database,and if we click a link,data would be retrieved from the database and data will be displayed in a new page.in this page
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list... is that to display image from database in a grid format or in a fixed column and row
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list... is that to display image from database in a grid format or in a fixed column and row
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list... is that to display image from database in a grid format or in a fixed column and row
display data from database on selecting option of dropdownlist
display data from database on selecting option of dropdownlist   Sir I want to display data from database by just selecting option of dropdown list... is that to display image from database in a grid format or in a fixed column and row
jfreechart display from access database data.
jfreechart display from access database data.  I have made a database... to retrieve the data from the access database using prepared statement and then display... is to be done in a servlet.. Note that it is a access made database. How can I
Display error message if data is already inserted in database
Display error message if data is already inserted in database   Display error message if data is already inserted in database Pls help me Thanks
How To Display both image and data into Swing JTable which is retrieved from ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database  So far this is my code how can i display both image and data from database.. while (rs.next()) { Vector row = new Vector(columns
How can we save a data list in jsf?
How can we save a data list in jsf?  I have a code in jsf that fires a query in Data Base each time it is called, i have added a validation check... hampered.. some one suggested me with page scope list.. any idea
How to display data fom MySQL DataBase-table in to JSP file by submitting a value in combobox.
How to display data fom MySQL DataBase-table in to JSP file by submitting... DataBase/DB Name:lokesh; Table Name:TR_list; columns:nodename,packageno,TR... have to display the Nodename and packageno. i.e.,select nodename,packageno from
how to display response in request page
how to display response in request page  Sir/Mom, My request page have three text boxes. Enter register number in the first box then click the submit button.This time shows the name and mark to display the second and third boxes
how to show data in database ?
how to show data in database ?  how to show the data in the database to the user in the textbox so that user can modify it and save it again
Advertisements
 

 

 

DMCA.com