JavaServer Pages Tag Library
This section describes the JavaServer PagesTM (JSP) tags available for creating dynamic web-based applications on top of Mulgara. The tag library includes general tags for communicating with a Mulgara server.
Software Requirements
The Mulgara custom tag libraries depend on a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher. Some of the examples listed in this section make use of the Jakarta Taglib libraries.
Configuring your Web Application
Follow these steps to configure your web application to use the Mulgara tag libraries:
- Copy the tag library JAR files to the
/WEB-INF/lib
subdirectory of your web application - Add a
<taglib>
element to your web application deployment Descriptor in/WEB-INF/web.xml
, as follows:<taglib>
<taglib-uri>http://mulgara.org/mulgara/taglibs/tks</taglib-uri>
<taglib-location>/WEB-INF/lib/tks-tag-2.1.jar</taglib-location>
</taglib>
To use the general Mulgara tags from the library in your JSP pages, add the following directive at the top of each page:
<%@ taglib prefix="tks" uri="http://mulgara.org/mulgara/taglibs/tks"%>
Where tks
is the tag name prefix you want to use for tags from the Mulgara library. You can change this to any prefix you like, but do not change the URL.
Note - All the examples in this section assume that the tag libraries are prefixed as shown above.
answer
Retrieves query answers from a statement.
Tag Body |
JSP |
||||
Restrictions |
None |
||||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
---|---|---|---|---|---|
|
|
false |
true |
n/a |
|
|
If set, it saves the specified answer to a variable with this name into the page context. To save the variable to a different context, use the |
||||
|
|
true |
true |
n/a |
|
|
Specifies the id of the statement to retrieve answers from. If no statement with the id exists, an exception occurs. |
||||
|
|
true |
true |
n/a |
|
|
The name of query to retrieve the answer of. The query with this id must be contained within the Note - You must specify the name of the query in the |
||||
|
|
false |
true |
n/a |
|
|
The scope of the variable created to hold the answer. Values must be one of |
||||
Scripting Variables |
Name |
Type |
|
||
|
|
|
|
||
|
If the |
||||
Example |
<%-- execute a statement (saving a list of answers to a variable named stmt2) --%> |
execute
Executes queries in a statement.
Tag Body |
Empty |
|||
Restrictions |
Must be enclosed in a statement tag |
|||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
|
false |
true |
n/a |
|
If set, it denotes the query to execute. The query with this id must be contained within the same enclosing |
|||
Example |
<%-- set the iTQL query --%> |
init
Initializes the Mulgara JSP tag environment, by setting the SOAP endpoint of the Mulgara server.
Tag Body |
Empty |
|||
Restrictions |
To be called before using any other Mulgara tag that communicates with a Mulgara server |
|||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
|
true |
true |
n/a |
|
The URL of the SOAP endpoint of the Mulgara server containing metadata you are interested in. For example, The URL is stored in the page context (by default) and is accessible as a |
|||
|
|
false |
true |
n/a |
|
The scope of the variables created for server and model. Value must be one of |
|||
Example |
<%-- initialise the environment --%> |
query
Adds an iTQL query to a statement.
Tag Body |
JSP |
|||
Restrictions |
Must be enclosed in a |
|||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
|
false |
true |
n/a |
|
If set, it can be referenced by an |
|||
Example |
<%-- set the iTQL query --%> |
render
Renders an XML document using a supplied stylesheet.
Tag Body |
JSP |
|||
Restrictions |
Must contain a body to transform |
|||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
|
true |
true |
n/a |
|
The relative path to the XSL stylesheet to use to render the tag body contents |
|||
Example |
<%-- render the results of a query --%> |
statement
Sends queries to a Mulgara instance.
Tag Body |
JSP The body may contain multiple queries, which by default are sent to the Mulgara server (in the order that they appear) in one request, resulting in a single set of results (one SOAP message) being set to the output stream. If you want to use multiple queries in a single |
|||
Restrictions |
If called without the server or model attributes set, the The body must contain at least one If you want to see results returned to the output stream, the body must also contain at least one |
|||
Attributes |
Name |
Required |
Runtime Expression Evaluation |
Mulgara Version |
|
|
false |
true |
n/a |
|
If set, a |
|||
|
|
false |
true |
n/a |
|
If set, overrides the URL of the SOAP endpoint of the Mulgara server set using the Note - This does not update the value, rather it sets a new URL for the execution of this tag only. |
|||
Scripting Variables |
Name |
Type |
|
|
|
|
java.util.List |
|
|
|
If the This list is ordered according to the ordering of the // get the answer to both queries The ordering is shown as an Note - That setting the |
|||
Example |
<%-- execute a statement --%> |