Sunday, January 3, 2016

ADF: JSTL with ADF Faces Rich Client Components

Following post will help you to understand the usage of JSTL along with ADF Faces.

The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many web application functionalities.

Here I listed commonly used JSTL expressions:

Function
Description
fn:contains()
Tests if an input string contains the specified substring.
fn:containsIgnoreCase()
Tests if an input string contains the specified substring in a case insensitive way.
fn:endsWith()
Tests if an input string ends with the specified suffix.
fn:escapeXml()
Escapes characters that could be interpreted as XML markup.
fn:indexOf()
Returns the index withing a string of the first occurrence of a specified substring.
fn:length()
Returns the number of items in a collection, or the number of characters in a string.
fn:replace()
Returns a string resulting from replacing in an input string all occurrences with a given string.
fn:startsWith()
Tests if an input string starts with the specified prefix.
fn:substring()
Returns a subset of a string.
fn:substringAfter()
Returns a subset of a string following a specific substring.
fn:substringBefore()
Returns a subset of a string before a specific substring.
fn:toLowerCase()
Converts all of the characters of a string to lower case.
fn:toUpperCase()
Converts all of the characters of a string to upper case.
fn:trim()
Removes white spaces from both ends of a string.


















You need to import JSTL namespace (xmlns:fn="http://java.sun.com/jsp/jstl/functions") into your page/fragment to refer JSTL tags.

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions">

JSTL Sample Examples: 
1. Get Records count in an Array List:
<af:outputText value="#{fn:length(pageFlowScope.empBean.employeeList)}" id="ot1"/>
2. Match content of String:          
<af:outputText value="#{fn:contains(bindings.deptName.inputValue,'SALES') ? 'SALES' :  'OTHER'}" id="ot1"/>

For more details, refer link


No comments:

Post a Comment

Provide your thoughts !