VisualBuilder
  Home > Jsp > Tutorials > Displaying the Data in Data Table - JSF Tutorial
Tell a friend
Link to us
Total Members
      Members: 84661
     
Sitemap Forum Chat
Home
JSF Tutorial Home
1 . Introduction to JSF
2 . Life Cycle of JSF Application
3 . JSF Releases
4 . Comparing JSF With Existing Web Technologies
5 . Steps To Create JSF Application Using NetBeans IDE
6 . Web.xml file
7 . First Hello World Application
8 . Running the Application
9 . Introduction To JSF Tag Libraries
10 . Form Designing With JSF
11 . Using Managed Bean With JSF -1
12 . Using Managed Bean With JSF -2
13 . Using Javascript to Validate Form
14 . Adding Navigation in JSF Application
15 . Creating the Reponse page for Registration Application
16 . Conversion Model of JSF
17 . Example Continued For Conversion Model
18 . Displaying the Data in Data Table
19 . Example Continued For Data Table
 
 
JSP Home
JSP Members (18709)
JSP Member Articles ( 11 )
JSP Discussion (71)
JSP Q & A ( 87 )
- JSP Ask Question
- JSP Questions
- JSP Unanswered Questions
JSP Resources
JSP Source Code (172)
JSP Articles (34)
JSP Blogs (333)
JSP Jobs (0)
JSP Components (10)
JSP Books (9)
JSP Websites (13)
JSP News (12)
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.Net Security,Internationalisation And Deployment
ASP.NET Tutorial
C# Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Hibernate Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (451 )
Source Code (3275 )
Articles (359 )
Books (372 )
Components (1596 )
News (892 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise

Jsp jsf Tutorial
 Displaying the Data in Data Table
  << Prev: Example Continued For Conversion Model Next: Example Continued For Data Table >>

We have just seen with previous example how the conversion model works for JSF and helps programmer to change the display by just changing the attribute value. The conversion model also helps programmer not to worry about the type casting of the data types during the development. For example, if any text field at the UI accepts the integer and in backing bean if it is mapped to Integer class then JSF conversion model automatically type cast the variable from presentation layer to model layer implicitly.


The representation of data in table format is no longer a worry now. JSF provide <h:dataTable> tag to represent the data in the table. The table can be bound to getter method of the backing bean to get the data and display in the tabular form.<h:column> tag is used to set the column values and header for the data.


Example:- Lets make an paging application which will display the text field for size of a single page and the current page number. The user will fill the information and datatable will only display the data for the particular page.


Step 1:- Create the backing bean PageBean for the example which has startIndex to show where to start display, the size of the page and the current page number.


package com.visualbuilder;


import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;


public class PageBean {


 ArrayList<RegistrationBean> list;
 Integer startIndex = new Integer(0);
 Integer size = new Integer(1);
 Integer pageNo = new Integer(1);


 public Integer getPageNo() {
   return pageNo;
  }


 public void setPageNo(Integer pageNo) {
  if (pageNo.intValue() > 10) {
    this.pageNo = 10;
    } else if (pageNo.intValue() <= 1) {
    this.pageNo = 1;
    } else {
    this.pageNo = pageNo;
   }
 }


 public ArrayList getItemList() {
  list = new ArrayList<RegistrationBean>();
  for (int i = 0; i <= 10; i++) {
         RegistrationBean bean = new RegistrationBean();
     bean.setName("VisualBuilder" + i);
     bean.setPassword("test" + i);
     bean.setDescription("Description" + i);
     list.add(bean);
    }
  return list;
 }


 public Integer getSize() {
  return size;
 }


 public void setSize(Integer size) {
  if (size.intValue() > 10) {
      this.size = 10;
     } else if (size.intValue() <= 1) {
      this.size = 1;
    } else {
      this.size = size;
   }
}


public Integer getStartIndex() {
   int index = (pageNo.intValue() - 1) * size.intValue() ;
   if (index<= 0) {
       startIndex = new Integer(0);
    } else if (index> 10) {
       startIndex = new Integer(11 - size.intValue());
    } else {
       startIndex = new Integer(index);

   }


  return startIndex;
 }


 public void setStartIndex(Integer startindex) {
   this.startIndex = startindex;
  }
}

  << Prev: Example Continued For Conversion Model Next: Example Continued For Data Table >>
Jsp Jsf Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
 
 
ADVERTISEMENT
Partner List
Code Project
ASP Alliance
More
 
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising