Previous Contents Index Next |
iPlanet Portal Server: Mobile Access Pack Programmer's Guide |
Chapter 6 JSP Tag Libraries
This chapter discusses the Java Server Page (JSP) tag libraries that facilitate the delivery of content from the iPlanet Messaging Server, iPlanet Calendar Server, and the iPlanet Personal Address Book to the user's mobile device.For detailed information on the usage of these tags within the Mobile Access Pack applications, see Chapter 5 "Application JSPs".
The JSP tag libraries for these applications:
Maintain client session state using the iPlanet Portal Server session mechanism.
Use the iPlanet Portal Server profile interface to retrieve profile information such as configuration (such as, backend service host/port), authentication (such as, credentials), and preferences (such as, address book sorting).
Log error and warning messages through the iPlanet Portal Server logging interface.
A tag typically follows one of the following patterns:
A context tag represents the session state for a valid authenticated connection to a backend service. This tag verifies that the session is still valid and provides a context for other tags to make requests to that service. The object a context tag gives reference to is called the service context.
At the first request, a connection is made to the backend service using the configuration and authentication information from the portal profile service. The service context is based upon the current portal session so that it is available across multiple requests.
A bean tag represents a java bean object to store on the current page context. The bean properties are retrieved or modified with the get or set tags. The following tag attributes specify how the bean is found:
The id attribute creates a new empty bean and stores it in the page context using the attribute's value.
If neither one of these attributes are set, then the current item in an enclosing collection parent tag is used.The name attribute value is a bean object. This attribute looks for a property with the attribute's value in the page context.
Get tag
The get tag retrieves the value of a property of a bean object and writes it to the page output.The property attribute specifies the name of the property to retrieve. If the property attribute is not specified, the results of the toString() method of the identified object will be returned as the results of the get tag.
If there is a name attribute, it is used to locate the bean in the page context. If there is no name attribute, then the enclosing bean parent tag is used to find the bean object.
Set Tag
The set tag modifies the value of a property of a bean object. The property attribute specifies the name of the property to modify. The value attribute specifies the value to set the property to. The tag body content is executed only if the tag fails to modify the bean property.
These tags provide access to a collection of beans constructed by a preceding command tag. Information about the collection can be accessed by the properties of a collection tag.
This collection is typically stored within a particular service context and is referenced implicitly by the name of the particular collection tag. For example, the <mail:messages> tag refers to the current messages collection stored within the current mail service context.
The id and name attributes permit bean tag like access to the properties of the collection. This is useful for constructing paginated access to a collection from within a Java Server Page. The optional beanid attribute, when specified when the collection is in iterative mode, stores the "current" bean from the collection onto the page context using the name specified by the beanid attribute.
The collection tags operate in non-iterative and iterative modes, as specified by the iterate attribute.
In the non-iterative mode, various properties of the collection can be set or retrieved and the body of a collection tag is processed only once.
In the iterative mode, the body is evaluated until a count property is exhausted (but at least once), and the iteration begins at an index in the collection as specified by the start property.
Usage Examples
The following reference to a collection tag establishes iteration parameters:<util:set property="start" value="$(start)"/>
<util:set property="count" value="10"/>
The following iterates through the collection in the specified manner:
<collection-tag name="example" iterate="true">
Item#<util:get property="indexOne"/>
<util:get property="some-bean-specific-property-name"/>
The following is a demonstration of the construction of a "next page" link
<collection-tag name="example">
<util:link tagstart="<a" tagend=">">
<url comp="whatever" file="next.jsp">
<parm name="start"><util:get property="nextStart"/></util:parm>
A command tag makes a request to a backend service. It uses the service context to make the request. The request arguments come from the tag attributes, request parameters, or iPlanet Portal Server profile settings. The request stores the results as properties in a service context and/or as beans on the page context. The tag body content is executed only if the request fails.
The content tag is used to set the content type and charset of the Java Server Page output stream. The charset is read and set from the user's iPlanet Portal Server profile. The content tag, combined with the catalog tags, enables JSP template files with no localized content to generate localized output (based on message catalogs) in the correct charset.
This tag provides access to session attributes.
These tags provide a way to store beans, that are beyond the scope of a page context, within the scope of a session.
These tags construct dynamically generated link type tags.
Before processing a tag, the attributes of most tags in the tag libraries are subject to the following rules of evaluation. If an attribute contains:
$(parameterName) - This is replaced by the value of the HTTP request parameter identified by parameterName.
${beanName:propertyName} - This is replaced by the value of the bean property identified by beanName and propertyName. The bean is assumed to exist on the current page context.
$[catalogName:key] - This is replaced by the value of the message catalog entry identified by catalogName and key. The catalogName refers to a catalog bean placed on the page context by a preceeding catalog tag.
$/componentName:attributeName[:defaultValue]/ - This is replaced by the client (device) specific value of the iPlanet Portal Server profile attribute as identified by componentName and attributeName. If the attribute does not exist, a null string is returned, unless defaultValue is specified as well.
The following are sample evaluation of some tag attribute values:
Example 1
<mail:message id="newmsg"><mail:set property="to" value="$(to)"/>
In the above example, the value of the attribute evaluates to the value of the HTTP request parameter named to.
Example 2
<mail:message name="newmsg"><mail:set property="to" value="${newmsg:to} $(to)"/>
In the above example, the value of the attribute evaluates to the value of the to property of the newmsg bean, followed by a space, and then followed by the value of the HTTP request parameter named to.
The Mobile Access Pack tag libraries log error and warning messages in:
This logging functionality is controlled by a property in the iPlanet Portal Server configuration file:
/etc/opt/SUNWips/platform.conf
For JSP debugging, edit this file. For example, open the platform.conf file and modify the following property:
This section provides an abbreviated list of each tag in the Mobile Access Pack tag libraries. For detailed information on each library and its collection of tags, refer to the relevant section in this chapter.
Table 6-1 contains a list of tags from the utilities tag library.
Utilities Tag Library">
Table 6-1    Utilities Tag Library
Tag
Description
This tag provides reference to the state of the utility service for a given session.
This tag operates on a collection of the specified bean objects, iterates through that collection, and makes that bean collection available to the page.
This tag retrieves the specified property and writes its value to the page output.
This tag copies the specified property value from the source bean to the target bean.
This tag tests the specified property and includes the tag body if the property evaluates to true.
This tag tests the specified property and includes the tag body if the property evaluates to false.
This tag lists all properties of the specified bean to the page output.
This tag loads a message catalog specified by the resource attribute and makes it available to the page.
This tag gets a message specified by the key attribute from a message catalog and writes it to the page output.
This tag is used to set the content type and charset of the JSP output stream from the user's iPlanet Portal Server profile.
This tag refers to an "edit" bean which specifies that certain editing be performed upon the enclosed body.
This tag performs a "forward" operation, similar to <jsp:forward>.
This tag performs an "include" operation, similar to <jsp:include>.
Table 6-2 contains a library of tags for the calendar server.
iPlanet Calendar Server Client Tag Library">
Table 6-2    iPlanet Calendar Server Client Tag Library
Tag
Description
This tag represents the state of the session to the calendar service.
This tag fetches the specified range of events into the calendar context.
This tag stores the specified event into the current calendar set.
This tag deletes the specified event from the current calendar set.
This tag either formats a datetime for output or parses one from an input.
This tag rolls the specified datetime attribute value forward or backward.
This tag sets or updates the specified event bean property or field.
This tag contains a collection of event beans in the calendar context.
Table 6-3 contains a library of tags for the mail server.
iPlanet Messaging Server Client Tag Library">
Table 6-3    iPlanet Messaging Server Client Tag Library
Tag
Description
This tag provides reference to the state of the mail service for a given session.
This tag fetches a collection of folders (a collection of messages), messages (a collection of lines), or lines into the context.
This tag refers to the current bean or folder within an enclosing collection or folders <mail:folders>.
This tag refers to the current bean or message within an enclosing collection of messages <mail:messages>.
This tag refers to the current bean or line within an enclosing collection of lines <mail:lines>.
This tag refers to a preset message from a collection of preset messages.
This tag retrieves the specified property and writes its value to the page output.
Table 6-4 contains a list of tags from the address book tag library.
Personal Address Book Client Tag Library">
Table 6-4    Personal Address Book Client Tag Library
Tag
Description
This tag is used to maintain state between requests. It ensures that the address book context is present within the current pageContext.
This tag fetches a collection of address book entries and sets the current collection within the current address book context (AbContext).
This tag refers to an address book entry within a collection of address book entries <ab:entries>.
This tag sets a bean property or updates the specified bean property.
This tag refers to a collection of address book entries or beans.
This tag library implements a collection of utility tags. The Utility Tag Libraries consists of the following tags:
Description
The context tag provides reference to the state of the utility service for a given session. Use of this tag without a body verifies correct operation of the utility service.
Properties
The tag has the following properties:
Example
The following is an example of the context tag:<util:set property="rfc2396" value="false"/>
<util:set property="urlAmpEntity" value="false"/>
Description
This tag constructs a link. The content of the link is dynamically generated.
Attributes
The tag has the following attributes:
Example
<util:link tagstart="<a" tagend=">"><util:url path="/DesktopServlet"></util:url>
<util:attr attr="method">GET</util:attr>
In the above example, the tag generates a link that includes session encoding, if needed. The path attribute is not subject to the rules of file lookup. The following is an example of the emitted markup:
<a href="/DesktopServlet?sid=1a34" method="GET">RETURN HOME</a>
Description
This tag adds attributes to a link tag. The content of this tag is dynamically generated.
Attributes
The tag has the following attributes:
Table 6-7    ipsUtils attr Tag Attributes
Attribute
Description
Required?
Specifies the fragment of text to include before the body of the tag.
Example
<util:link tagstart="<a" tagend=">"><util:url path="/DesktopServlet"></util:url>
<util:attr attr="method">GET</util:attr>
In the above example, the tag generates a link that includes session encoding, if needed. The path attribute is not subject to the rules of file lookup. The following is an example of the emitted markup:
<a href="/DesktopServlet?sid=1a34" method="GET"/>
Description
This tag aids in the construction of URLs. The path to the URL can be specified in the following ways:
The path attribute can specify a path to be used during the construction of the URL. Client specific rewriting can not be applied to this value.
Also, query string parameters can be appended to the URL by including the appropriate parm tags within the body of the url tag. All body content is discarded except the value of the parm tag.The file and comp attributes can together specify a JSP resource that will be resolved using client data driven file lookup rules.
Restrictions
Either the path attribute, or comp and file attributes must be specified.
Attributes
The tag has the following attributes:
Examples
The following are examples of the URL tag:Example 1: The following is an example of url tag usage, with the path attribute:
<util:link tagstart="<a" tagend=">">
<util:url path="/DesktopServlet"></util:url>
<util:attr attr="method">GET</util:attr>
In the above example, the tag generates a link that includes session encoding, if needed. The path attribute is not subject to the rules of file lookup. The following is an example of the emitted markup:
<a href="/DesktopServlet?sid=1a34" method="GET"/>
Example 2: The following is an example of url tag usage, with file and comp attributes:
<util:link tagstart="<a" tagend=">">
<util:url file="inbox.jsp" comp="mail"></util:url>
<util:attr attr="method">GET</util:attr>
In the above example, this tag generates a link that has been resolved to the correct path for the client that has requested the page. The session encoding is added as needed. The following is an example of the emitted markup:
<a href="/jsp/default/mail/wml/inbox.jsp?sid=1a34" method="GET"/>
Description
This tag adds request parameters to URLs. The following will be added as a query string parameter to the URL being constructed by an enclosing url tag:Here, name is a value specified by the parm tag's name attribute and BODY is whatever is evaluated as the parm tag's body.
The urlAmpEntity property of the utility context controls whether the query string parameter separator is generated as "&" or "&".
Tag Parent
<utilsPrefix:url> or <utilsPrefix:forward>
Attributes
The tag has the following attributes:
Table 6-9    ipsUtil parm Tag Attributes
Attribute
Description
Required?
Example
<util:link tagstart="<a" tagend=">"><util:url path="/DesktopServlet">
<util:parm name="op1">stuff</util:parm>
<util:attr attr="method">GET</util:attr>
In the above example, the tag generates a link that includes session encoding, if needed. The path attribute is not subject to the rules of file lookup. The following is an example of the resultant markup:
<a href="/DesktopServlet?sid=1a34&op1=stuff" method="GET"/>
Description
This tag operates on a collection of the specified bean objects, iterates through that collection, and makes that bean collection available to the page.
Restrictions
If the id attribute is specified, then a collection of type and size is created. If the name attribute is specified, then the collection is restored from the page context. The type attribute specifies the java class name of the object to create for the collection.
Attributes
The tag has the following attributes:
Examples
The following are examples of beans collection:Example 1: The following example creates a list of five dates and sets the seconds to the index:
<util:beans id="dates" size="5" type="java.util.Date" iterate="true">
<util:get property="index" id="index"/>
<util:set property="seconds" id="index"/>
Example 2: The following example iterates through the dates collection:
<util:beans name="dates" iterate="true"/>
Description
This tag makes a bean object available to the page. It is similar to the <jsp:useBean> except that it interoperates with the other bean tags in this tag library.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The type attribute specifies the java class name of the object to use or create.
Attributes
The tag has the following attributes:
Table 6-12    ipsUtil bean Tag Attributes
Attribute
Description
Required?
Examples
The following are examples of the bean tag:Example 1: The following example makes a date available:
<util:bean type="java.util.Date">
Example 2: The following example makes a specified date available:
<util:bean id="date" type="java.util.Date"/>
date = <util:get name="date"/>
Description
This tag retrieves the specified property and writes its value to the page output.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute must be used to specify what to retrieve. If the property attribute is not specified, then the bean object itself is retrieved as a string. The id attribute specifies the name to save the retrieved property as. If the eval attribute is specified, then the value of the attribute is evaluated and written to the page output.
Attributes
The tag has the following attributes:
Examples
The following are examples of the get tag:Example 1: The following example gets the date time property from the parent bean:
<util:bean type="java.util.Date">
time = <util:get property="time"/>
Example 2: The following example gets the date time property from the specified bean:
<util:bean id="date" type="java.util.Date"/>
time = <util:get name="date" property="time"/>
Example 3: The following example gets the date bean itself as a string:
<util:bean type="java.util.Date">
Example 4: The following example gets a non-string bean property:
<util:get property="prop" id="handle"/>
Example 5: The following example gets an evaluated attribute:
<util:catalog id="catalog" resource="catalog"/>
<util:bean id="bean" type="java.util.Date"/>
Msg = <util:get eval="$[catalog:msg]"/>
Param = <util:get eval="$(requestparam)"/>
Bean = <util:get eval="{bean}"/>
Description
This tag updates the specified property.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute specifies what to update. The value attribute specifies the string value to update the property. The id specifies the bean object value to update the property. Either value or id must be specified.
Attributes
The tag has the following attributes:
Table 6-14    ipsUtil set Tag Attributes
Attribute
Description
Required?
Specifies the edit bean that will be applied to the value prior to storage
Examples
The following are examples of the set tag:Example 1: The following example sets the date time property on the parent bean:
<util:bean type="java.util.Date">
<util:set property="time" value="0"/>
Example 2: The following example sets the date time property on the named bean:
<util:bean id="date" type="java.util.Date"/>
<util:set name="date" property="time" value="0"/>
Example 3: The following example sets a bean onto another bean property:
<util:bean id="one" type="BeanOne"/>
<util:bean id="two" type="Beantwo"/>
<util:set name="two" id="one" property="one"/>
Description
This tag copies the specified property value from the source bean to the target bean.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate.
Attributes
The tag has the following attributes:
Table 6-15    ipsUtil copy Tag Attributes
Attribute
Description
Required?
Example
The following example copies the time property from d1 to d2:<util:bean name="d1" type="java.util.Date"/>
<util:bean name="d2" type="java.util.Date"/>
<util:copy name="d2" property="time" source="d1"/>
Description
This tag tests the specified property and includes the tag body if the property evaluates to true.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute specifies what to test. The value attribute specifies the string value to test the property. The id attribute specifies the bean object value to test the property. If neither value or id is specified, then the test is true if the property value is non-null.
Attributes
The tag has the following attributes:
Table 6-16    ipsUtil if Tag Attributes
Attribute
Description
Required?
Examples
The following are examples of the if bean:Example 1: The following example tests if the date time equals to zero on the parent bean:
<util:bean type="java.util.Date">
<util:if property="time" value="0">
Example 2: The following example tests if the date time == 0 on named bean:
<util:bean id="date" type="java.util.Date"/>
<util:if name="date" property="time" value="0">
Example 3: The following example tests if the bean property is non-null:
... Bean.name != null </util:if>
Example 4: The following example tests using two beans:
<util:bean id="one" type="BeanOne"/>
<util:bean id="two" type="BeanTwo"/>
<util:if name="one" property="bean" id="two">
Description
This tag tests the specified property and includes the tag body if the property evaluates to false.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute specifies what to test. The value attribute specifies the string value to test the property. The id attribute specifies the bean object value to test the property. If neither value or id is specified, then the test is true if the property value is non-null.
Attributes
The tag has the following attributes:
Table 6-17    ipsUtil ifnot Tag Attributes
Attribute
Description
Required?
Examples
The following are examples of the ifnot bean:Example 1: The following example tests if the date time does not equal to zero on the parent bean:
<util:bean type="java.util.Date">
<util:ifnot property="time" value="0">
Example 2: The following example tests if the date time does not equal to zero on the named bean:
<util:bean id="date" type="java.util.Date"/>
<util:ifnot name="date" property="time" value="0">
Example 3: The following example tests if the bean property is null:
Example 4: The following example tests using two beans:
<util:bean id="one" type="BeanOne"/>
<util:bean id="two" type="BeanTwo"/>
<util:ifnot name="one" property="bean" id="two">
Description
This tag lists all properties of the specified bean to the page output. The list format may not be suitable for markup and should be contained in <PRE> or equivalent tags.
Restrictions
If the name attribute is not specified, a parent bean tag is used to locate the bean on which to operate.
Examples
The following are examples of the list bean:Example 1: The following example lists the properties of a parent bean:
<util:bean type="java.util.Date">
Example 2: The following example lists the properties of a named bean:
<util:bean id="date" type="java.util.Date"/>
Description
This tag provides access to session attributes.
Restrictions
If the id attribute is specified, then the page attribute is restored using the session attribute. If the name attribute is specified, then the session attribute is saved using the page attribute. If neither attribute is specified, then the session attribute is removed.
Attributes
The tag has the following attributes:
Examples
The following are examples of the session bean:Example 1: The following example creates a date bean to use:
<util:bean id="now" type="java.util.Date"/>
Example 2: The following example saves that bean into the session attributes:
<util:session name="now" attribute="viewDay"/>
Example 3: The following example restores from the session attributes:
<util:session id="now" attribute="viewDay"/>
Example 4: The following example removes the bean from the session attributes:
<util:session attribute="viewDay"/>
Description
This tag loads a message catalog specified by the resource attribute and makes it available to the page. A message catalog is a locale specific java.util.ResourceBundle object.
Restrictions
The id attribute is used to make the message catalog available after the catalog end tag. The name attribute is used to make an existing catalog available.This tag also makes a scripting variable, specified by the id attribute, available. Use the getMsg(String key) method to get the message string.
Attributes
The tag has the following attributes:
Examples
The following are examples of the message catalog:Example 1: The following example gets a message from a sample catalog:
<util:catalog resource="sample">
Message = <util:msg key="message"/>
Example 2: The following example gets a key from a named catalog:
<util:catalog id="sample" resource="sample"/>
Message = <util:msg name="sample" key="message"/>
Example 3: The following example gets a key using scripting:
<util:catalog id="sample" resource="sample"/>
Message = <%= sample.getMsg("message") %>
Description
This tag gets a message specified by the key attribute from a message catalog and writes it to the page output.
Restrictions
If the name attribute is not specified, then a parent catalog is used to locate the message catalog.
Attributes
The tag has the following attributes:
Table 6-20    ipsUtil msg Tag Attributes
Attribute
Description
Required?
Examples
The following are examples of the msg command:Example 1: The following example gets a message from a sample catalog:
<util:catalog resource="sample">
Message = <util:msg key="message"/>
Example 2: The following example gets a key from a named catalog:
<util:catalog id="sample" resource="sample"/>
Message = <util:msg name="sample" key="message"/>
Description
The content tag is used to set the contentType and character set of the JSP output stream from the user's iPlanet Portal Server profile. The character set used when the JSP is compiled does not matter since there is no localized content in the JSP. The content tag enables generating localized output (based on message catalogs) in the correct character set.
Attributes
The tag has the following attributes:
Table 6-21    ipsUtil content Tag Attributes
Attribute
Description
Required?
Example
The following is an example of the content tag usage:<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<%@ taglib uri="/taglibs/ips_taglib_util.jar" prefix="util" %>
<util:content type="text/vnd.wap.wml"/>
<util:catalog resource="mail" id="i18n" />
<util:link tagstart="<card" tagend=">"><%
%><util:attr attr="ontimer"><%
%><util:url file="doInbox.jsp" comp="mail"></util:url><%
%><util:link tagstart="<go" tagend="/>"><%
%><util:url file="doInbox.jsp" comp="mail"></util:url><%
<b><util:msg name="i18n" key="sendcancel"/></b>
Description
This tag is used to perform limited editing on the tag body. The edit tag refers to an "edit" bean which specifies that certain editing be performed upon the enclosed body. The edit will be performed in the following order:The edit bean can also be referenced by the get and/or set tags which results in the appropriate modifications to the values being get or set.
Restrictions
At least one attribute must be specified and both the attributes must not be specified together.
Attributes
The tag has the following attributes:
Table 6-22    ipsUtil edit Tag Attributes
Attribute
Description
Required?
Example
The following is an example to truncate a mail subject line:<util:set property="truncation" value="20"/>
<util:set property="escape" value="true"/>
<mail:get property="subject"/>
<mail:get property="subject" edit="t1"/>
Description
This tag performs a "forward" operation, similar to <jsp:forward>, but constructs the JSP resource name in one of the following two ways:
The path attribute can specify a path to be used verbatim during the construction of the URL. Client data specific rewriting will not be applied to this value.
Additionally, query string parameters can be appended to the URL by including the appropriate parm tags within the body of the forward tag. With the exception of the parm tags, all body content is discarded.The file and comp attributes together can specify a JSP resource that will be resolved using client data driven file lookup rules.
The parameters that are ultimately passed to the destination resource are the concatenation of those present in the original request, and those specified in the body of the forward tag.
Restrictions
At least one of the attributes must be specified.
Attributes
The tag has the following attributes:
Example
The following is a forward tag example usage:<util:forward file="inbox.jsp" comp="mail"/>
<util:forward file="inbox.jsp" comp="mail">
<util:parm name="parm1">abc</util:parm>
Description
This tag performs an "include" operation, similar to <jsp:include>, but will construct the JSP resource name in one of the following two ways:
The path attribute may specify a path to be used verbatim during the construction of the URL. Client data specific rewriting will not be applied to this value.
The file and comp attributes together can specify a JSP resource that will be resolved using client data driven file lookup rules.
Tag Body
Empty
Restrictions
At least one of the attributes must be specified.
Attributes
The tag has the following attributes:
Example
The following is an example of the include tag usage:<util:include file="inbox-common.jsp" comp="mail"/>
iPlanet Calendar Server Client Tag Library
This tag library consists of a collection of tags that enables calendar access to any class of device that utilizes a markup style presentation system. The calendar tag libraries consists of the following tags.
Description
The context tag represents the state of the session to the calendar service. If no connection exists, then an authenticated session is created and the context for that session is saved for use across requests.Pages must have this tag near the top of the page and before using any other tags in the calendar tag library.
Properties
The tag provides the following page properties:
Examples
The following is an example of the calendar context tag:
Description
This tag fetches the specified range of events into the calendar context. The range is specified using datetime tags with the id attribute. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Restrictions
Use either day or both start and end attributes to specify the range of events to fetch. If no attributes are specified, all events for the current day are retrieved.
Attributes
The tag has the following attributes:
Table 6-27    Calendar fetch Tag Attributes
Attribute
Description
Required?
Examples
The following are examples of the fetch command:Example 1: The following example fetches todays events:
Example 2: The following example fetches events for a day:
Example 3: The following example fetches events for a range:
<cal:fetch start="start" end="end">
Description
This tag stores the specified event into the current calendar set. It can either store a new event or update an existing event. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Restrictions
If the name attribute is not specified, then a parent event tag is used to find the event to operate on. The modifier attribute can only be used to update an existing event.
Attributes
The tag has the following attributes:
Table 6-28    Calendar store Tag Attributes
Attribute
Description
Required?
Specifies how to update an existing event (see Table 6-29)
The modifier attribute can accept either the string or number as follows:
Table 6-29    Modifier Attribute Values
String
Number
Description
Examples
The following are examples of the store command:Example 1: The following example stores an event by name:
Example 2: The following example stores an event and all future occurrences:
<cal:store modifier="THISANDFUTURE">
Description
This tag deletes the specified event from the current calendar database. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Restrictions
If the name attribute is not specified then a parent event tag is used to find the event to operate on. The modifier attribute can only be used to update an existing event.
Attributes
The tag has the following attributes:
Table 6-30    Calendar delete Tag Attributes
Attribute
Description
Required?
Specifies how to modify future events (see Table 6-31)
The modifier attribute can accept either the string or number as follows:
Table 6-31    Modifier Attribute Values
String
Number
Description
Examples
The following are examples of the delete command:Example 1: The following example deletes an event by name
Example 2: The following example deletes an event and all future occurrences
<cal:delete modifier="THISANDFUTURE">
Description
The dateformat tag either formats a datetime (see "datetime") for output or parses one from an input. The format attribute specifies the format to use to format the output or to parse from input. If the parse attribute is specified, then that value is used as the parse string to set the specified datetime. If the parse attribute is not specified, then the datetime is formatted to the page output.
Restrictions
If the name attribute is specified, then that datetime bean is used. Otherwise the parent datetime tag is used.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Examples
The following are examples of the dateformat command:Example 1: The following is an example to create a "now" datetime and output in hours and minutes:
<cal:dateformat name="now" format="hh:mm"/>
Example 2: The following is an example to set datetime from hours and minutes to parse string:
<cal:dateformat format="hh:mm" parse="10:30"/>
Description
The dateroll tag rolls the specified datetime (see "datetime") attribute value forward or backward. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Attributes
The tag has the following attributes:
Table 6-34    Calendar dateroll Tag Attributes
Attribute
Description
Required?
Specifies the datetime bean to operate on. If the datetime bean is not specified, then it searches for a datetime parent tag.
Specifies the field of the roll and by default, it is set to DATE. These correspond to fields in java.util.Calendar (see Table 6-35)
Specifies the amount of the roll. The amount of roll must be an integer value. By default, it is set to one. Note that positive values roll forward and negative values roll backward.
Table 6-35    java.util.Calendar field values
Field
Description
Examples
The following are examples of the dateroll command:Example 1: The following is an example to roll forward one day from today
Example 2: The following is an example to roll forward 2 weeks
amount="2" field="WEEK_OF_YEAR"/>
Example 3: The following is an example to roll back 5 hours
Description
The datetime tag provides the date and time bean properties.
Restrictions
Only one attribute must be used at a time. The datetime properties are only valid from the start tag to the end tag.
Attributes
The tag has the following attributes:
Table 6-36    Calendar datetime Tag Attributes
Attribute
Description
Required?
Properties
The tag provides the following bean properties:
Table 6-37    Calendar datetime Tag Properties
Property
Description
Access
Examples
The following are examples of the datetime bean:Example 1: The following is an example is to create a 'now' datetime at the current time
Example 2: The following is an example is to create a 'start' datetime with today at 10:30
<cal:set property="hours" value="10"/>
<cal:set property="minutes" value="30"/>
Example 3: The following example uses an existing datetime
Day = <cal:get property="day"/>
Month = <cal:get property="month"/>
Year = <cal:get property="Year"/>
Description
This tag provides the event properties.
Restrictions
Only one attribute must be used at a time. If no attributes are specified, then the current event in the parent collection is used. The event properties are only valid from the start tag to the end tag.
Attributes
The tag has the following attributes:
Table 6-38    Calendar event Tag Attributes
Attribute
Description
Required?
Specifies the index into the current event list of the event bean to find
Properties
The tag provides the following bean properties:
Examples
The following are examples of the event bean:Example 1: The following is an example to create a 'new' event
Example 2: The following is an example to create a 'new' event with a summary
<cal:set property="summary" value="Event Summary"/>
Example 3: The following example uses an existing event:
Start = <cal:get property="startTime"/>
End = <cal:get property="endTime"/>
Summary = <cal:get property="summary"/>
Example 4: The following example retrieves an event by id
<cal:event id="event" eventid="$(eid)">
<cal:set property="summary" value="new summary"/>
Example 5: The following example refers to a current event in the event collection:
Description
This tag refers to a collection of event beans in the calendar context. This tag iterates on its body until the collection is exhausted or as constrained by the start and count properties.
Restrictions
The current event collection on the calendar context is used.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Example
The following example enumerates through the event bean collection:
Description
This tag gets the specified event bean property or field.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. Either property or field attribute can be used to specify what to retrieve. The id attribute specifies the name to save the retrieved property.
Attributes
The tag has the following attributes:
Examples
The following are examples of the get bean:Example 1: The following is an example to get the event summary property:
summary=<cal:get property="summary"/>
Example 2: The following is an example to get the datetime HOURS field:
hours=<cal:get field="HOURS"/>
Description
This tag sets or updates the specified event bean property or field. If the property is already successfully set, it skips the body content. Otherwise, it evaluates the body content.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. Either the property or field attribute must be used to specify what to update. Either the value or id attribute is used to specify the value of the property to update.
Attributes
The tag has the following attributes:
Table 6-43    Calendar set Tag Attributes
Attribute
Description
Required?
Specifies the name of the java.util.Calendar field to update
Examples
The following are examples of the set bean:Example 1: The following is an example to set the event summary property:
<cal:set property="summary" value="new summary"/>
Example 2: The following is an example to set the datetime HOURS field:
<cal:set field="HOURS" value="10"/>
Example 3: The following is an example to set the event start time to a datetime bean:
<cal:set property="startTime" id="now"/>
iPlanet Messaging Server Client Tag Library
The tags in this library enable email access to WML and cHTML clients. It consists of the following tags.
Description
This tag provides reference to the state of the mail service for a given session. Use of this tag without a body verifies the correct operation of the mail service.
Properties
The tag provides the following bean properties:
Example
The following is an example of the context tag usage:<p>Number of New Messages:<mail:get property="inboxNumNewMsgs"/>
Description
The mail fetch tag builds a collection of the type specified by the collection attribute. This tag can fetch into the context a collection of:
Folders, which are a collection of messages from the user's inbox
A fetch of any given collection type creates a "current" collection of that type; for example, a fetch of a "messages" collection creates the current "messages" collection. These "current" collections are associated with the current Mail context.Messages, which are a collection of lines from the user's message
A fetch of a "lines" collection assumes that id refers to a message within a "messages" collection that was fetched previously, using the same mail context.
If an error occurs during processing, the tag body is evaluated and the remainder of the page will be skipped.
Attributes
The tag has the following attributes:
Table 6-45    ipsMail fetch Tag Attributes
Attribute
Description
Required?
Folders, the attribute value is ignored
Messages, the attribute identifies the folder to fetch the messages from
Indicates which field to Sort By. See Table 6-46 for information on possible values for this attribute.
Folders, the attribute value is ignored
Messages, the attribute identifies by which message field to sort by
Folders, the attribute value can be up or down
Table 6-46    ipsMail sb Attribute Values
Possible Values
Description
Properties
The tag provides the following bean properties:
Example
The following is an example of the fetch command:<mail:fetch collection="messages" id="INBOX" sb="date" sd="down">
<mail:fetch collection="lines" id="0">
Description
This tag sends or forwards an email message. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Attributes
The tag has the following attributes:
Table 6-48    ipsMail sendmessage Tag Attributes
Attribute
Description
Required?
Properties
The tag provides the following bean properties:
Example
The following is an example of the sendmessage command:<mail:set property="to" value="$(to)"/>
<mail:set property="subject" value="$(subject)"/>
<mail:set property="text" value="$(text)"/>
<mail:sendmessage msgname="foo">
Description
This tag deletes an email message from the current folder. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Attributes
The tag has the following attributes:
Table 6-50    ipsMail deletemessage Tag Attributes
Attribute
Description
Required?
Specifies the message to delete. The index specifies an entry within the current messages collection.
Properties
The tag provides the following bean properties:
Example
The following is an example of the deletemessage command:<mail:deletemessage index="$(idx)">
Description
This tag provides the folder properties. This tag refers to the current bean or folder within an enclosing collection of folders <mail:folders>. The body of this tag can contain get tags to generate the contents of the specified bean tag or current folder.
Tag Parent
<mailPrefix:folders>
Properties
The tag provides the following bean properties:
Table 6-52    ipsMail folder Tag Properties
Property
Description
Access
Example
The following is an example of the folder tag:<mail:fetch collection="folders"/>
<p>Folder Name:<mail:get property="name"/>
Description
This tag refers to a collection of folders in the mail context. This tag iterates upon its body until the collection is exhausted or as constrained by the start and count properties.
Restrictions
The start and count properties must be set only when the iterate attribute is set to false.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Examples
The following are examples of the folders tag:<mail:folders id="folderlist">
<mail:set property="start" value="$(start)"/>
<mail:set property="count" value="5"/>
<mail:folders name="folderlist" iterate="true">
<p>Folder Name:<mail:get property="name"/>
Description
This tag provides the message properties. It refers to the current bean or message within an enclosing collection of messages <mail:messages>. A message bean can be created and referenced by using the id or name attributes. The body of this tag can contain get or set tags to generate the contents of the specified bean tag or the current message.
Tag Parent
<mailPrefix:messages>
Attributes
The tag has the following attributes:
Table 6-55    ipsMail message Tag Attributes
Attribute
Description
Required?
Properties
The tag provides the following bean properties:
Table 6-56    ipsMail message Tag Properties
Property
Description
Access
Provides access to the full address specified in the "From:" header (for example, John Doe <jdoe@somedomain.com>).
Provides access to just the address specified in the "From:" header, excluding the comment field (for example, <jdoe@somedomain.com>).
Provides access to the comment specified in the "From:" header if there is one, excluding the actual address (for example, John Doe).
Provides access to the "Reply-To:" header if the header exists. If the header does not exist, the same value as the from property is returned.
Provides access to just the address portions of the "Reply-To:" header if the header exists. If the header does not exist, the same value as the fromAddress property is returned.
Provides access to just the comment portions of the "Reply-To:" header if the header exists and has a comment. If the header does not exist, the same value as the fromPersonal property is returned.
Provides access to just the address portions of the "To:" header.
Provides access to just the address portions of the "To:" header, excluding any address that matches the user's.
Provides access to just the address portions of the "Cc:" header.
Provides access to just the address portions of the "Cc:" header, excluding any address that matches the sender's.
Examples
The following are examples of the message tag:<mail:fetch collection="messages" id="INBOX" sb="date" sd="down"/>
<mail:set property="start" value="$(start)"/>
<mail:set property="count" value="5"/>
<mail:messages iterate="true">
<p>Subject: <mail:get property="subject"/>
Description
This tag refers to a collection of message beans in the mail context. This tag iterates upon its body until the collection is exhausted or as constrained by the start and count properties.
Restrictions
The start and count properties must be set only when the iterate attribute is set to false.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Example
The following are examples of the messages tag:<mail:fetch collection="messages" id="INBOX" sb="date" sd="down"/>
<mail:set property="start" value="$(start)"/>
<mail:set property="count" value="5"/>
<mail:messages name="msgs" iterate="true">
<p>Subject: <mail:get property="subject"/>
Description
This tag provides the line properties. This tag refers to the current bean or line within an enclosing collection of lines <mail:lines>. The body of this tag can contain get tag to generate output derived from the contents of the line tag.
Properties
The tag provides the following bean properties:
Table 6-59    ipsMail line Tag Properties
Property
Description
Access
Example
The following is an example of the line tag:<mail:fetch collection="lines" id="$(msgidx)"/>
<mail:set property="start" value="$(start)"/>
<mail:set property="count" value="5"/>
Description
This tag refers to a collection of line beans. This tag iterates upon its body until the collection is exhausted or as constrained by the start and count properties.
Restrictions
The start and count properties must be set only when the iterate attribute is set to false.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Examples
The following are examples of the lines tag:<mail:fetch collection="lines" id="$(msgidx)"/>
<mail:set property="start" value="$(start)"/>
<mail:set property="count" value="5"/>
<mail:lines name="list" iterate="true">
Description
This tag refers to a preset message from a collection of preset messages. It provides access to the properties of the current message from the preset messages collection.
Restrictions
The presetmsg tag can only be used with the presetmsgs collection tag to provide access to the current preset message in the collection.
Properties
The tag provides the following bean properties:
Table 6-62    ipsMail presetmsg Tag Properties
Property
Description
Access
Example
The following is an example of the presetmsg bean:<mail:presetmsgs iterate="true">
preset msg text = <mail:get property="msg"/>
Description
This tag refers to a collection of preset messages. It provides access to the collection of preset messages. The tag body is evaluated once for each item in the collection or as constrained by the start and count properties.
Restrictions
Use the presetmsg tag to access a preset message from the collection. The start and count properties must be set only when the iterate attribute is set to false.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Example
The following is an example of the presetmsgs collection:<mail:presetmsgs iterate="true">
preset msg text = <mail:get property="msg"/>
Description
This tag retrieves the specified property and writes its value to the page output.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute must be used to specify what to retrieve. If the property attribute is not specified, then the bean object itself is retrieved as a string. The id attribute specifies the name to save the retrieved property. If the eval attribute is specified, then the value of the attribute is evaluated and written to the page output.
Attributes
The tag has the following attributes:
Example
The following is an example to get the subject property:<mail:get property="subject"/>
Description
This tag updates the specified property.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute specifies what to update. The value attribute specifies the string value to update the property. The id specifies the bean object value to update the property. Either value or id must be specified.
Attributes
The tag has the following attributes:
Table 6-66    ipsMail set Tag Attributes
Attribute
Description
Required?
Specifies the edit bean that will be applied to the value prior to storage
Example
The following is an example to set the message subject property:<mail:set property="subject" value="new subject"/>
Personal Address Book Client Tag Library
This address book tag library consists of a collection of tags that enables address book access to WML and cHTML clients. The address book tag library consists of the following tags:
Description
This tag is used to maintain address book state between requests. It must appear before all other tags within the ipsAb tag library.
Tag Body
Java Server Page or Empty
Properties
The tag provides the following bean properties:
Table 6-67    ipsAb context Tag Properties
Property
Description
Access
Example
The following is an example of the context tag usage:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:fetch any="$(any)" ln="$(ln)" fn="$(fn)" bp="$(bp)" em="$(em)" hp="$(hp)" fp="$(fp)" mp="$(mp)" pp="$(pp)" sb="ln" sd="up">
Error in Looking up address book.
Number of Address Book entries:
<ab:get property="numEntries"/>
Description
The fetch tag sets the current collection within the current address book context. If no attributes (see Table 6-68) are specified, the entire address book is returned within the collection. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.All of the search attributes support simple wildcard expressions, using the '*' character. If the wildcard is not specified, the '*' character is prepended and appended to the search expression to yield a search pattern that produces results that match any entry that at least contains the requested string.
Restrictions
Only sb and sd attributes can be used with the any attribute.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Example
The following is an example of the fetch command:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:fetch ln="$(ln)" fn="$(fn)" bp="$(bp)" em="$(em)" hp="$(
hp)" fp="$(fp)" mp="$(mp)" pp="$(pp)" sb="ln" sd="up">
Error in Looking up address book.
Description
The add tag adds an entry to the address book. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Attributes
The tag has the following attributes:
Table 6-70    ipsAb add Tag attributes
Attribute
Description
Required?
Indicates the name of the address book entry bean to add and store
Properties
The tag provides the following bean properties:
Example
The following is an example of the add command:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:set property="fn" value="$(fn)"/>
<ab:set property="ln" value="$(ln)"/>
<ab:set property="em" value="$(em)"/>
Description
The delete tag deletes an address book entry. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Restrictions
This tag must be used before a fetch or collection tag.
Attributes
The tag has the following attributes:
Table 6-72    ipsAb delete Tag Attributes
Attribute
Description
Required?
Properties
The tag provides the following bean properties:
Example
The following is an example of the delete command:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:delete entryid="$(entryid)">
Description
The modify tag modifies an address book entry. If an error occurs during processing, the tag body is evaluated and the remainder of the page is skipped.
Restrictions
This tag must be used before a fetch or collection tag.
Attributes
The tag has the following attributes:
Table 6-74    ipsAb modify Tag Attributes
Attribute
Description
Required?
Indicates the name of the address book entry bean that requires the modifications.
Properties
The tag provides the following bean properties:
Example
The following is an example of the modify command:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:set property="fn" value="$(fn)"/>
<ab:set property="ln" value="$(ln)"/>
<ab:set property="em" value="$(em)"/>
<ab:modify name="modentry" entryid="$(entryid)">
Description
This tag provides the properties for an address book entry. This tag refers to an address book entry within a collection of address book entries <ab:entries>. The body of this tag can contain get or set tags to generate the contents of the specified bean tag or entry.
Tag Parent
<abPrefix: entries>
Restrictions
Only one attribute must be used at a time. If no attributes are specified, then the current entry in the parent collection is used.
Attributes
The tag has the following attributes:
Table 6-76    ipsAb entry Tag Attributes
Attribute
Description
Required?
Properties
The tag provides the following bean properties:
Table 6-77    ipsAb entry Tag Properties
Property
Description
Access
Examples
The following are examples of the entry bean:Example 1: The following is an example of the current entry in the entries collection:
<ab:get property="numEntries"/>
Entry Id: <ab:get property="entryid"/>
First Name: <ab:get property="fn"/>
Last Name: <ab:get property="ln"/>
Email: <ab:get property="em"/>
Example 2: The following example retrieves an entry by entryid:
<ab:entry entryid="$(entryid)">
First Name: <ab:get property="fn"/>
Last Name: <ab:get property="ln"/>
Email: <ab:get property="em"/>
Description
This tag refers to a collection of address book entries or beans in the address book context. This tag iterates upon its body until the collection is exhausted or as constrained by the start and count properties.
Restrictions
The Address Book fetch command must be sent before invoking this tag. The start and count properties must be set only when the iterate attribute is set to false.
Attributes
The tag has the following attributes:
Properties
The tag provides the following bean properties:
Example
The following is an example of the entries tag:<ab:get property="numEntries"/>
Entry Id: <ab:get property="entryid"/>
First Name: <ab:get property="fn"/>
Last Name: <ab:get property="ln"/>
Email: <ab:get property="em"/>
Description
This tag retrieves the specified bean property.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute must be used to specify what to retrieve. If the property to retrieve is not specified, then the bean object itself is retrieved as a string. The id attribute specifies the name to save the retrieved property as. If the eval attribute is specified, then the value of the attribute is evaluated and written to the page output.
Attributes
The tag has the following attributes:
Examples
The following is an example of the get bean:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:fetch ln="$(ln)" fn="$(fn)" bp="$(bp)" em="$(em)" hp="$(
hp)" fp="$(fp)" mp="$(mp)" pp="$(pp)" sb="ln" sd="up">
Error in Looking up address book.
Number of Address Book entries:
<ab:get property="numEntries"/>
Entry Id: <ab:get property="entryid"/>
First Name: <ab:get property="fn"/>
Last Name: <ab:get property="ln"/>
Email: <ab:get property="em"/>
Description
This tag sets a bean property or updates the specified bean property.
Restrictions
If the name attribute is not specified, then it uses a parent bean tag to locate the bean on which to operate. The property attribute specifies what to update. The value attribute specifies the string value to update the property with. The id attribute specifies the bean object value to update the property with. Either value or id attribute must be specified.
Attributes
The tag has the following attributes:
Table 6-81    ipsAb set Tag Attributes
Attribute
Description
Required?
Specifies the edit bean that will be applied to value prior to storage
Examples
The following is an example of the set bean:<%@ taglib uri="/taglibs/ips_taglib_ab.jar" prefix="ab" %>
<ab:set property="fn" value="$(fn)"/>
<ab:set property="ln" value="$(ln)"/>
<ab:set property="em" value="$(em)"/>
Previous Contents Index Next
Copyright © 2001 Sun Microsystems, Inc. All rights reserved.
Last Updated November 14, 2001