23
Dec
09

Pagination using JSF


This page is about JSF and pagination.

Requirements

  • Maven
  • Basic Understanding of JSF
  • tomahawk

Installation

You need the following in your pom.xml to get all this to work.

	<dependency>
		<groupId>org.apache.myfaces.core</groupId>
		<artifactId>myfaces-api</artifactId>
		<version>1.2.8</version>
	</dependency>

	<dependency>
		<groupId>org.apache.myfaces.tomahawk</groupId>
		<artifactId>tomahawk</artifactId>
		<version>1.1.9</version>
	</dependency>

	<dependency>
		<groupId>org.apache.myfaces.core</groupId>
		<artifactId>myfaces-impl</artifactId>
		<version>1.2.8</version>
	</dependency>
	<dependency>
		<groupId>org.apache.tiles</groupId>
		<artifactId>tiles-jsp</artifactId>
		<version>2.1.4</version>
	</dependency>

JSP Example

Putting the following code in the “footer” facet of your t:dataTable will get all this to work.

Don’t forget to set the “rows” attribute of the dataTable so that it will paginate 5 rows at a time.

<f:facet name="footer">
  		<t:dataScroller id="scroller" paginator="true" >
		<f:facet name="first">
		<h:outputText value="first"/>
		</f:facet>
		<f:facet name="previous">
		<h:outputText value="prev"/>
		</f:facet>
		<f:facet name="next">
		<h:outputText value="next"/>
		</f:facet>

		<f:facet name="last">
		<h:outputText value="last"/>
		</f:facet>
  		</t:dataScroller>
</f:facet>
Advertisements

0 Responses to “Pagination using JSF”



  1. Leave a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 75 other followers

December 2009
S M T W T F S
« Nov   Jan »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blog Stats

  • 813,810 hits

%d bloggers like this: