Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

How to create a page

First of all, create a page in XHTML file format, a file with a .xhtml extension and declared the necessary Namespaces.

Code Block
languagexml
<!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"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
	  xmlns:crm="http://java.sun.com/jsf/composite/crm">

</html>

Define the template of the page in a ui:composition tag.

Code Block
languagexml
<ui:composition template=""></ui:composition>

...

Tag Library

URI

Prefix

Contents

XHTML namespacehttp://www.w3.org/1999/xhtml
Tags for xhtml
JavaServer Faces Facelets Tag Libraryhttp://xmlns.jcp.org/jsf/facelets

ui:

Tags for templating
PrimeFaces componentshttp://primefaces.org/ui

p:

Tags for PrimeFaces components
JavaServer Faces Core Tag Libraryhttp://java.sun.com/jsf/core

f:

Tags for JavaServer Faces custom actions that are independent of any particular render kit
Pass-through Attributes Tag Libraryhttp://xmlns.jcp.org/jsf/passthrough

p:

Tags to support HTML5-friendly markup
JavaServer Faces HTML Tag Libraryhttp://java.sun.com/jsf/html

h:

JavaServer Faces component tags for all UIComponent objects
JSTL Functions Tag Libraryhttp://java.sun.com/jsp/jstl/functions

fn:

JSTL 1.2 Functions Tags
JSTL Core Tag Libraryhttp://java.sun.com/jsp/jstl/core

c:

JSTL 1.2 Core Tags
CRM Composite Components Tag Libraryhttp://java.sun.com/jsf/composite/crm

crm:

Tags for CRM Components

...

A typical JavaServer Faces application includes one or more managed beans, each of which can be associated with the components used in a particular page. 

A managed bean for summary pages must extend SummaryView class and for data entry pages must extend DataEntryView class.

Code Block
languagejava
@ManagedBean(name = "summaryManagedBeanView", eager = true)
@ViewScoped
public class SummaryManagedBeanView extends SummaryView {

}

@ManagedBean(name = "dataEntryManagedBeanView", eager = true)
@ViewScoped
public class DataEntryManagedBeanView extends DataEntryView{

}

Class SummaryView 

SummaryView class implements Commonly Used Functions for summary pages.

Class DataEntryView

DataEntryView class implements Commonly Used Functions for data entry pages.

The below list shows functions that can be used from data entry pages:

Expand
titlepublic void addCustomFields()

This method adds custom fields on the page.

...

Expand
titlepublic void onload()

This method initialize page parameters and is executed on GET request of a page.


Expand
titlepublic List<CRMDO> searchCountry(String searchValue)

This method returns a list of countries where country name starts with the specified search value. 

...

Expand
titlepublic void setTranslations(CRMDO dto)

This method sets the translations of the specified data object

Commonly Used Functions

The below list shows functions that can be used both from summary and data entry pages:

Expand
titlepublic void createArchivedFile(String id)

This method creates an archive file with the specified id.

...