Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

Related Documents

  • JavaDoc List (Documents Page)
  • Control Servlet Guide
  • Regions Guide

Introduction

The Open For Business JSP Tag Library consists of a set of custom tags that make it easier to use other components of the OFBiz Core Framework.

While there are some basic conditional, flow control, i18n and other general tags included in the library many of these can be found in other more generalized tag library like the Jakarta library. They are mainly included here for convenience and have defaults that are more friendly for use in the OFBiz framework.

The following table presents a list of the OFBiz tags and some basic information about them for reference. The rest of the document explains each tag in detail

 

Tag NameBodyContentTag ClassTEI Class
urlJSPUrlTag 
contenturlJSPContentUrlTag 
ifJSPIfTag 
unlessJSPUnlessTag 
iteratorJSPIteratorTagIteratorTEI
iteratorNextJSPIterateNextTagIterateNextTEI
iteratorHasNextJSPIteratorHasNextTag 
formatJSPFormatTag 
printemptyPrintTag 
fieldemptyEntityFieldTag 
entityfieldemptyEntityFieldTag 
inputvalueemptyInputValueTag 
i18nBundleJSPI18nBundleTag 
i18nMessageJSPI18nMessageTag 
i18nMessageArgumentemptyI18nMessageArgumentTag 
serviceJSPServiceTag 
paramemptyParamTag 
objectJSPObjectTagObjectTEI

 

URL Tags

ofbiz:url

Add control path and URL encode if necessary. This is for links to dynamic pages in the same webapp and the body is meant to contain a forward slash ("/") and then the name of a request defined in the controller.xml file. Parameters should also be included inside the tag.

The tag will automatically insert the mounting point of the current webapp and the mounting point of the control servlet.

The tag will also create a secure (HTTPS) URL (a URL that refers to the secure port on the server) to automatically go from insecure to secure areas, and will create an plain or non-secure (HTTP) URL to automatically go from secure to insecure areas of the site. This is configured in the url.properties file. See the Core Configuration Guide for more details.

This tag has no attributes.

ofbiz:contenturl

Builds a URL for content referred to by this page. This is generally for static content such as images that can be stored on a different server. So, if necessary it will create a complete URL for the static content and is takes into account whether the content should be referred to securely (with HTTPS) or not (with HTTP).

This is also configured in the url.properties file as described in the Core Configuration Guide.

This tag has no attributes.

Conditional Tags

ofbiz:if

Processes the body content of the tag if the named attribute value exists and if it meets any size and value conditions specified.

Attribute NameRequired?ExprVal?Description
nameYYThe name of the page, request, session, or application attribute to use for the comparison.
typeNNThe type of the attribute Object. It is not necessary to specify this because the tag will test the type of the object at runtime. Only necessary if the default behavior does not behave as desired.
valueNYIf specified the named attribute value will be compared to this value. Can be specified using the <%=...%> syntax to refer to an existing object declared within the JSP.
sizeNNIf specified this value will be compared to the size of the named attribute value. This is mostly applicable for type such as Collections, Maps, Strings, etc.

ofbiz:unless

Does the exact opposite of the if tag. In other words the body content will be evaluated if the named attribute value does not exist or if it does exist but does not meet the size and value conditions.

The attributes of the unless tag are the same as the attributes of the if tag. Refer to the table above in the if tag section for detailed information on these attributes.

Flow Control Tags

ofbiz:iterator

The iterator tag iterates over a collection of elements in a collection object in a named attribute. The individual elements are placed in a pageContext attribute, and made available in the JSP Java context for use in scriptlets.

Attribute NameRequired?ExprVal?Description
ameYNThe name of the attribute that the collection of elements will come from. Can be in the page, request, session or application contexts.
propertyNNThe name of the attribute and Java variable that the individual elements will be put into as the iterator iterates.
typeNNThe type of the elements within the collections. This must be specified so that the Java context variable can be created. Defaults to org.ofbiz.entity.GenericValue, which is one of the more common objects to iterate over in OFBiz framework based applications.
expandMapNNIf expandMap is true then the iterator elements must implement the Map interface the the keys in the Map entries must be Strings. Each map entry will be put into the pageContext if this is set using the Map key value as the attribute name. Must be true or false. Defaults to false.
offsetNYIf specified the iteration will start at the given offset index instead of at the beginning of the collection.
limitNYIf specified only the specified number of iterations will be done. In other words this limits the number of elements pulled from the iterator.
Sub-Element NameHow ManyDescription
iterateNext0 to manyDescribed below.
iteratorHasNext0 to manyDescribed below.

ofbiz:iteratorNext

Grab the next element in the collection of the parent iterator tag.

Attribute NameRequired?ExprVal?Description
nameNNThe name of the attribute to put the element in. Defaults to the name specified in the property attribute of the parent iterator tag.
typeNNThe type of the elements within the collections. This must be specified so that the Java context variable can be created. Defaults to org.ofbiz.entity.GenericValue, which is one of the more common objects to iterate over in OFBiz framework based applications.
expandMapNNIf expandMap is true then the iterator elements must implement the Map interface the the keys in the Map entries must be Strings. Each map entry will be put into the pageContext if this is set using the Map key value as the attribute name. Must be true or false. Defaults to false.

ofbiz:iteratorHasNext

Only process body if parent iterator tag has another entry.

This tag has no attributes.

Data Presentation Tags

ofbiz:format

Formats dates, numbers and currencies from the value in the body of the tag. It has one attribute that specifies how the text should be formatted.

Attribute NameRequired?ExprVal?Description
typeNNSpecified how the type of format to apply to the body value. Must be "currency", "number", or "date". If not type is specified the original value is printed.

ofbiz:print

Prints an attribute from the pageContext. If null prints the default value or nothing if no default is specified.

Attribute NameRequired?ExprVal?Description
attributeYYThe name of the attribute to print.
defaultNYThe default value to print if the specified attribute is not found.

ofbiz:field

Displays a properly formatted string from field in the specified attribute.

Attribute NameRequired?ExprVal?Description
attributeYNThe name of the attribute that contains the field to print.
typeNNOptionally specifies the type of the field to print. Can be "currency" or any of the Java field types. If not specified the tag will automatically determine the Java type.
defaultNYThe default value to print if the specified field is not found.
prefixNNIf the resulting message is not empty this string will be printed before the field value.
suffixNNIf the resulting message is not empty this string will be printed after the field value.

ofbiz:entityfield

Displays a properly formatted localized string from a field in the entity in the specified attribute. The prefix and suffix attribute contents will print before/after if the field is not null or empty.

  • No labels