of

Tag Library Information 
InfoValue
ID (tag prefix)of
URIhttp://omnifaces.org/functions
Function Summary 
TypeFunctionDescription
java.lang.Stringabbreviate(java.lang.String, int) Abbreviate the given text on the given size limit with ellipsis.
java.lang.Stringconcat(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.Stringcapitalize(java.lang.String) Capitalize the given string, i.e. uppercase the first character.
java.lang.Stringparenthesize(java.lang.Object) Parenthesize the given object. This will only wrap the given object in parenthesis when it's not empty or zero.
java.lang.StringreplaceAll(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.Stringmatches(java.lang.String, java.lang.String) Returns true if the given string matches the given pattern.
java.lang.StringprettyURL(java.lang.String) URL-prettify the given string. It performs the following tasks:
  • Lowercase the string.
  • Remove combining diacritical marks.
  • Replace non-alphanumeric characters by hyphens.
This is useful when populating links with dynamic paths obtained from user controlled variables, such as blog titles.
java.lang.StringencodeURL(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.StringencodeURI(java.lang.String) URI-encode the given string using UTF-8. This is useful for cases where you need to embed path parameters in URLs.
java.lang.StringencodeBase64(java.lang.String) Base64-encode the given string using UTF-8. This is useful for cases where you need to create data URLs.
java.lang.StringescapeJS(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.Stringformat1(java.lang.String, java.lang.Object) Format the given string with 1 parameter using java.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.Stringformat2(java.lang.String, java.lang.Object, java.lang.Object) Format the given string with 2 parameters using java.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.Stringformat3(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object) Format the given string with 3 parameters using java.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.Stringformat4(java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) Format the given string with 4 parameters using java.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.Stringformat5(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 java.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.StringstripTags(java.lang.String) Remove XML tags from a given text and return plain text.
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.
booleancontains(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.ListsetToList(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.ListiterableToList(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>.
jakarta.faces.model.DataModeliterableToModel(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.ListmapToList(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.StringjoinArray(java.lang.Object, java.lang.String) Joins all elements of the given array to a single string, separated by the given separator.
java.lang.StringjoinCollection(java.util.Collection, java.lang.String) Joins all elements of the given collection to a single string, separated by the given separator.
java.lang.StringjoinMap(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.ListsplitList(java.util.List, int) Splits the given list into a list of sublists of the given fragment size.
java.lang.StringtoJson(java.lang.Object) Encode given object as JSON.
java.lang.StringprintStackTrace(java.lang.Throwable) Print the stack trace of the given exception.
java.lang.Stringconvert(java.lang.String, java.lang.Object) Convert given object to string using Converter#getAsString(FacesContext, UIComponent, Object) of the converter identified by the given converter ID, invoked with FacesContext#getCurrentInstance(), UIComponent#getCurrentComponent(FacesContext) and given object as arguments.
java.lang.StringformatDate(java.lang.Object, 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.util.Date, java.util.Calendar and java.time.Temporal are supported.
java.lang.StringformatDateWithTimezone(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddYears(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddMonths(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddWeeks(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddDays(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddHours(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddMinutes(java.lang.Object, 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, java.util.Calendar and java.time.Temporal are supported.
java.lang.ObjectaddSeconds(java.lang.Object, 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. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intyearsBetween(java.lang.Object, java.lang.Object) Returns the amount of years between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intmonthsBetween(java.lang.Object, java.lang.Object) Returns the amount of months between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intweeksBetween(java.lang.Object, java.lang.Object) Returns the amount of weeks between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intdaysBetween(java.lang.Object, java.lang.Object) Returns the amount of days between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
inthoursBetween(java.lang.Object, java.lang.Object) Returns the amount of hours between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intminutesBetween(java.lang.Object, java.lang.Object) Returns the amount of minutes between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
intsecondsBetween(java.lang.Object, java.lang.Object) Returns the amount of seconds between two given dates. This will be negative when the end date is before the start date. java.util.Date, java.util.Calendar and java.time.Temporal are supported.
java.util.MapgetMonths() 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.MapgetShortMonths() 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.MapgetDaysOfWeek() 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.MapgetShortDaysOfWeek() 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.StringgetMonth(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.StringgetShortMonth(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.StringgetDayOfWeek(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.StringgetShortDayOfWeek(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.StringformatBytes(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:
  • 1023 bytes will appear as 1023 B
  • 1024 bytes will appear as 1.0 KiB
  • 500000 bytes will appear as 488.3 KiB
  • 1048576 bytes will appear as 1.0 GiB
java.lang.StringformatCurrency(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.StringformatNumber(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.StringformatNumberDefault(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.StringformatNumberDefaultForLocale(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.StringformatPercent(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.StringformatThousands(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):
  • 999.999 will appear as 999.999
  • 1000 will appear as 1k
  • 1004 will appear as 1k
  • 1005 will appear as 1.01k
  • 1594 will appear as 1.59k
  • 1595 will appear as 1.6k
  • 9000 will appear as 9k
  • 9900 will appear as 9.9k
  • 9994 will appear as 9.99k
  • 9995 will appear as 10k
  • 99990 will appear as 100k
  • 9994999 will appear as 9.99M
  • 9995000 will appear as 10M
The format locale will be set to the one as obtained by Faces#getLocale(). If the value is null, NaN or infinity, then this will return null.
java.lang.StringformatThousandsUnit(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):
  • 999 will appear as 999 B
  • 1000 will appear as 1 kB
  • 1004 will appear as 1 kB
  • 1005 will appear as 1.01 kB
  • 1594 will appear as 1.59 kB
  • 1595 will appear as 1.6 kB
  • 9000 will appear as 9 kB
  • 9900 will appear as 9.9 kB
  • 9994 will appear as 9.99 kB
  • 9995 will appear as 10 kB
  • 99990 will appear as 100 kB
  • 9994999 will appear as 9.99 MB
  • 9995000 will appear as 10 MB
The format locale will be set to the one as obtained by Faces#getLocale(). If the value is null, NaN or infinity, then this will return null.
java.lang.Objectcoalesce(java.lang.Object, java.lang.Object) Return the first non-null object from the two objects.
booleanisInstance(java.lang.String, java.lang.Object) Returns true if given object is an instance of the class as identified by given class name.
java.lang.ObjectevalAttribute(jakarta.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.StringgraphicImageURL(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.StringgraphicImageURLWithType(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. "webp", "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.StringgraphicImageURLWithTypeAndLastModified(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. "webp", "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.StringgetRequestBaseURL() 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.StringgetRequestDomainURL() Returns the HTTP request domain URL. This is the URL with the scheme and domain, without any trailing slash.
java.lang.StringgetRequestURLWithQueryString() 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.StringgetRemoteAddr() 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.