<anyxmlelement xmlns:of="http://omnifaces.org/functions"/>
Info | Value |
---|---|
ID (tag prefix) | of |
URI | http://omnifaces.org/functions |
Type | Function | Description |
---|---|---|
java.lang.String | abbreviate(java.lang.String, int) | Abbreviate the given text on the given size limit with ellipsis. |
java.lang.String | concat(java.lang.Object, java.lang.Object) |
Concatenate the string representation of the given objects. This is useful when you don't know
beforehand if one of the both hands is a string or is null , otherwise the new EL 2.2
#{bean.string1.concat(bean.string2)} can just be used.
|
java.lang.String | capitalize(java.lang.String) | Capitalize the given string, i.e. uppercase the first character. |
java.lang.String | replaceAll(java.lang.String, java.lang.String, java.lang.String) | Replace all matches of the given pattern on the given string with the given replacement. |
java.lang.String | matches(java.lang.String, java.lang.String) | Returns true if the given string matches the given pattern. |
java.lang.String | prettyURL(java.lang.String) |
URL-prettify the given string. It performs the following tasks:
|
java.lang.String | encodeURL(java.lang.String) |
URL-encode the given string using UTF-8. This is useful for cases where you can't use
<f:param> .
|
java.lang.String | escapeJS(java.lang.String) | Escapes the given string according the JavaScript code rules. This escapes among others the special characters, the whitespace, the quotes and the unicode characters. Useful whenever you want to use a Java string variable as a JavaScript string variable. |
java.lang.String | format1(java.lang.String, java.lang.Object) |
Format the given string with 1 parameter using javax.text.MessageFormat API.
Design notice: There are five formatX() functions, each taking 1 to 5 format parameters because EL
functions does not support varargs methods nor overloaded function names.
|
java.lang.String | format2(java.lang.String, java.lang.Object, java.lang.Object) |
Format the given string with 2 parameters using javax.text.MessageFormat API.
Design notice: There are five formatX() functions, each taking 1 to 5 format parameters because EL
functions does not support varargs methods nor overloaded function names.
|
java.lang.String | format3(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object) |
Format the given string with 3 parameters using javax.text.MessageFormat API.
Design notice: There are five formatX() functions, each taking 1 to 5 format parameters because EL
functions does not support varargs methods nor overloaded function names.
|
java.lang.String | format4(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) |
Format the given string with 4 parameters using javax.text.MessageFormat API.
Design notice: There are five formatX() functions, each taking 1 to 5 format parameters because EL
functions does not support varargs methods nor overloaded function names.
|
java.lang.String | format5(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) |
Format the given string with 5 parameters using javax.text.MessageFormat API.
Design notice: There are five formatX() functions, each taking 1 to 5 format parameters because EL
functions does not support varargs methods nor overloaded function names.
|
java.lang.Object[] | createArray(int) |
Creates and returns a dummy object array of the given size. This is useful if you want to iterate
n times over an <ui:repeat> , which doesn't support EL in begin
and end attributes.
|
java.lang.int[] | createIntegerArray(int, int) |
Creates and returns an integer array which starts at the given integer and ends at the given integer, inclusive. This is
useful if you want to for example populate a <f:selectItems> which shows an integer range to
represent days and years.
|
boolean | contains(java.lang.Object[], java.lang.Object) |
Returns true if the string representation of an item of the given array equals to the
string representation of the given item. This returns false if either the array or the
item is null. This is useful if you want to for example check if #{paramValues.foo}
contains a certain value.
|
java.lang.Object[] | reverseArray(java.lang.Object[]) | Returns a copy of the array with items in reversed order. |
java.util.List | setToList(java.util.Set) |
Converts a Set<E> to a List<E> . Useful when you want to iterate
over a Set in for example <ui:repeat> .
|
java.util.List | iterableToList(java.lang.Iterable) |
Converts any iterable, like a Collection or more specifically a Set into a List so it can
be used with components like <ui:repeat> and <h:datatable> .
|
javax.faces.model.DataModel | iterableToModel(java.lang.Iterable) |
Wraps any iterable, like a Collection or more specifically a Set into a DataModel so it can
be used with components like <ui:repeat> and <h:datatable> .
|
java.util.List | mapToList(java.util.Map) |
Converts a Map<K, V> to a List<Map.Entry<K, V>> . Useful when
you want to iterate over a Map in for example <ui:repeat> . Each of the
entries has the usual getKey() and getValue() methods.
|
java.lang.String | joinArray(java.lang.Object, java.lang.String) | Joins all elements of the given array to a single string, separated by the given separator. |
java.lang.String | joinCollection(java.util.Collection, java.lang.String) | Joins all elements of the given collection to a single string, separated by the given separator. |
java.lang.String | joinMap(java.util.Map, java.lang.String, java.lang.String) | Joins all elements of the given map to a single string, separated by the given key-value pair separator and entry separator. |
java.lang.Object[] | splitArray(java.lang.Object, int) | Splits the given array into an array of subarrays of the given fragment size. |
java.util.List | splitList(java.util.List, int) | Splits the given list into a list of sublists of the given fragment size. |
java.lang.String | toJson(java.lang.Object) | Encode given object as JSON. |
java.lang.String | printStackTrace(java.lang.Throwable) | Print the stack trace of the given exception. |
java.lang.String | formatDate(java.util.Date, java.lang.String) |
Format the given date in the given pattern and system default timezone. This is useful when you want to
format dates in for example the title attribute of an UI component, or the
itemLabel attribute of select item, or wherever you can't use the
<f:convertDateTime> tag.
|
java.lang.String | formatDateWithTimezone(java.util.Date, java.lang.String, java.lang.Object) |
Format the given date in the given pattern with given timezone. This is useful when you want to format
dates in for example the title attribute of an UI component, or the itemLabel
attribute of select item, or wherever you can't use the <f:convertDateTime> tag.
|
java.util.Date | addYears(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of years. The years can be negative. |
java.util.Date | addMonths(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of months. The months can be negative. |
java.util.Date | addWeeks(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of weeks. The weeks can be negative. |
java.util.Date | addDays(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of days. The days can be negative. |
java.util.Date | addHours(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of hours. The hours can be negative. |
java.util.Date | addMinutes(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of minutes. The minutes can be negative. |
java.util.Date | addSeconds(java.util.Date, int) | Returns a new date instance which is a sum of the given date and the given amount of seconds. The seconds can be negative. |
int | yearsBetween(java.util.Date, java.util.Date) | Returns the amount of years between two given dates. This will be negative when the end date is before the start date. |
int | monthsBetween(java.util.Date, java.util.Date) | Returns the amount of months between two given dates. This will be negative when the end date is before the start date. |
int | weeksBetween(java.util.Date, java.util.Date) | Returns the amount of weeks between two given dates. This will be negative when the end date is before the start date. |
int | daysBetween(java.util.Date, java.util.Date) | Returns the amount of days between two given dates. This will be negative when the end date is before the start date. |
int | hoursBetween(java.util.Date, java.util.Date) | Returns the amount of hours between two given dates. This will be negative when the end date is before the start date. |
int | minutesBetween(java.util.Date, java.util.Date) | Returns the amount of minutes between two given dates. This will be negative when the end date is before the start date. |
int | secondsBetween(java.util.Date, java.util.Date) | Returns the amount of seconds between two given dates. This will be negative when the end date is before the start date. |
java.util.Map | getMonths() |
Returns a mapping of month names by month numbers for the current locale. For example: "January=1", "February=2",
etc. This is useful if you want to for example populate a <f:selectItems> which shows all
months. The locale is obtained by Faces#getLocale(). The mapping is per locale stored in a local cache
to improve retrieving performance.
|
java.util.Map | getShortMonths() |
Returns a mapping of short month names by month numbers for the current locale. For example: "Jan=1", "Feb=2",
etc. This is useful if you want to for example populate a <f:selectItems> which shows all
short months. The locale is obtained by Faces#getLocale(). The mapping is per locale stored in a local
cache to improve retrieving performance.
|
java.util.Map | getDaysOfWeek() |
Returns a mapping of day of week names in ISO 8601 order for the current locale. For example: "Monday=1", "Tuesday=2",
etc. This is useful if you want to for example populate a <f:selectItems> which shows all
days of week. The locale is obtained by Faces#getLocale(). The mapping is per locale stored in a local cache
to improve retrieving performance.
|
java.util.Map | getShortDaysOfWeek() |
Returns a mapping of short day of week names in ISO 8601 order for the current locale. For example: "Mon=1", "Tue=2",
etc. This is useful if you want to for example populate a <f:selectItems> which shows all
short days of week. The locale is obtained by Faces#getLocale(). The mapping is per locale stored in a local
cache to improve retrieving performance.
|
java.lang.String | getMonth(java.lang.Integer) | Returns the month name from the mapping associated with the given month number for the current locale. For example: "1=January", "2=February", etc. The locale is obtained by Faces#getLocale(). |
java.lang.String | getShortMonth(java.lang.Integer) | Returns the short month name from the mapping associated with the given month number for the current locale. For example: "1=Jan", "2=Feb", etc. The locale is obtained by Faces#getLocale(). |
java.lang.String | getDayOfWeek(java.lang.Integer) | Returns the day of week name from the mapping associated with the given day of week number in ISO 8601 order (Monday first) for the current locale. For example: "1=Monday", "2=Tuesday", etc. The locale is obtained by Faces#getLocale(). |
java.lang.String | getShortDayOfWeek(java.lang.Integer) | Returns the short day of week name from the mapping associated with the given day of week number in ISO 8601 order (Monday first) for the current locale. For example: "1=Mon", "2=Tue", etc. The locale is obtained by Faces#getLocale(). |
java.lang.String | formatBytes(java.lang.Long) |
Format the given bytes to nearest 10n with IEC binary unit (KiB, MiB, etc) with rounding
precision of 1 fraction. For example:
|
java.lang.String | formatCurrency(java.lang.Number, java.lang.String) |
Format the given number as currency with the given symbol. This is useful when you want to format numbers as
currency in for example the title attribute of an UI component, or the itemLabel
attribute of select item, or wherever you can't use the <f:convertNumber> tag. The format
locale will be set to the one as obtained by Faces#getLocale() .
|
java.lang.String | formatNumber(java.lang.Number, java.lang.String) |
Format the given number in the given pattern. This is useful when you want to format numbers in for example the
title attribute of an UI component, or the itemLabel attribute of select item, or
wherever you can't use the <f:convertNumber> tag. The format locale will be set to the one as
obtained by Faces#getLocale() .
|
java.lang.String | formatNumberDefault(java.lang.Number) |
Format the given number in the default pattern of the default locale. This is useful when you want to format numbers in for
example the title attribute of an UI component, or the itemLabel attribute of select
item, or wherever you can't use the <f:convertNumber> tag. The default locale is
the one as obtained by Faces#getLocale() .
|
java.lang.String | formatNumberDefaultForLocale(java.lang.Number, java.lang.Object) |
Format the given number in the default pattern of the given locale. This is useful when you want to format numbers in for
example the title attribute of an UI component, or the itemLabel attribute of select
item, or wherever you can't use the <f:convertNumber> tag. The given
locale can be a {@link Locale} object or a string representation.
|
java.lang.String | formatPercent(java.lang.Number) |
Format the given number as percentage. This is useful when you want to format numbers as
percentage in for example the title attribute of an UI component, or the itemLabel
attribute of select item, or wherever you can't use the <f:convertNumber> tag. The format
locale will be set to the one as obtained by Faces#getLocale() .
|
java.lang.String | formatThousands(java.lang.Number) |
Format the given number to nearest 10n (rounded to thousands), immediately suffixed (without space)
with metric unit (k, M, G, T, P or E), rounding half up with a precision of 3 digits, whereafter
trailing zeroes in fraction part are stripped. Numbers lower than thousand are not affected.
For example (with English locale):
Faces#getLocale() .
If the value is null , NaN or infinity, then this will return null .
|
java.lang.String | formatThousandsUnit(java.lang.Number, java.lang.String) |
Format the given number to nearest 10n (rounded to thousands), suffixed with a space, the metric unit
prefix (k, M, G, T, P or E) and the given unit, rounding half up with a precision of 3 digits, whereafter
trailing zeroes in fraction part are stripped.
For example (with English locale and unit B ):
Faces#getLocale() .
If the value is null , NaN or infinity, then this will return null .
|
java.lang.Object | coalesce(java.lang.Object, java.lang.Object) |
Return the first non-null object from the two objects.
|
java.lang.Object | evalAttribute(javax.faces.component.UIComponent, java.lang.String) | Gets the value of a component's attribute by trying to evaluate a value expression associated with the attribute first, and if none exists goes via the regular attribute mechanism (which will likely call a getter on the component if indeed no value expression is associated). |
java.lang.String | graphicImageURL(java.lang.String) |
Returns @GraphicImageBean URL based on given expression string.
The expression string must be a quoted string. Any nested quotes can be escaped with backslash.
Usage example: <a href="#{of:graphicImageURL('images.full(product.imageId)')}"> <o:graphicImage value="#{images.thumb(product.imageId)}" /> </a> |
java.lang.String | graphicImageURLWithType(java.lang.String, java.lang.String) |
Returns @GraphicImageBean URL based on given expression string and image type.
The expression string must be a quoted string. Any nested quotes can be escaped with backslash.
The image type is represented as file extension. E.g. "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc.
Usage example: <a href="#{of:graphicImageURLWithType('images.full(product.imageId)', 'png')}"> <o:graphicImage value="#{images.thumb(product.imageId)}" type="png" /> </a> |
java.lang.String | graphicImageURLWithTypeAndLastModified(java.lang.String, java.lang.String, java.lang.Object) |
Returns @GraphicImageBean URL based on given expression string, image type and last modified.
The expression string must be a quoted string. Any nested quotes can be escaped with backslash.
The image type is represented as file extension. E.g. "jpg", "png", "gif", "ico", "svg", "bmp", "tiff", etc.
The "last modified" timestamp can be either a java.lang.Long , java.util.Date ,
or java.lang.String which is parseable as java.lang.Long .
Usage example: <a href="#{of:graphicImageURLWithTypeAndLastModified('images.full(product.imageId)', 'png', product.lastModified)}"> <o:graphicImage value="#{images.thumb(product.imageId)}" type="png" lastModified="#{product.lastModified}" /> </a> |
java.lang.String | getRequestBaseURL() |
Returns the HTTP request base URL. This is the URL from the scheme, domain until with context path, including
the trailing slash. This is the value you could use in HTML <base> tag.
|
java.lang.String | getRequestDomainURL() | Returns the HTTP request domain URL. This is the URL with the scheme and domain, without any trailing slash. |
java.lang.String | getRequestURLWithQueryString() | Returns the HTTP request URL with query string. This is the full request URL with query string as the enduser sees in browser address bar. |
java.lang.String | getRemoteAddr() |
Returns the Internet Protocol (IP) address of the client that sent the request. This will first check the
X-Forwarded-For request header and if it's present, then return its first IP address, else just
return HttpServletRequest#getRemoteAddr() unmodified.
|
Output generated by Vdldoc View Declaration Language Documentation Generator.