|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
AjaxEnableTag | This class is a custom tag (AjaxEnableTag) that must be placed on a page AFTER all other Ajax-enabled tags. |
AjaxEventTag | This class is a custom tag (AjaxEventTag) that emits the small script element following an element to be Ajax-enabled. |
AjaxInit | This class is responsible for all configuration tasks to prepare for Ajax functionality. |
AjaxManualTag | This class is a custom tag (AjaxManualTag) that emits the script necessary to set up a manual AJAX event. |
AjaxTimerTag | This class is a custom tag (AjaxTimerTag) that emits the script necessary to set up a timed AJAX event. |
AjaxUtils | This class contains utility functions used throughout the taglib. |
The AjaxParts Taglib (APT).
ajaxConfig | This is simply the root element of the document.
Attributes: None. |
ajaxConfig/handler |
This element is used to define a custom handler (request, response or
error). This is entirely optional!
Attributes:
|
ajaxConfig/handler/function |
This names the Javascript function that implements this handler. Note
that this function must adhere to a specific signature, which is
described later in the "Creating Custom Handlers" section.
Attributes: None. |
ajaxConfig/handler/location |
This defines where the function can be found. It can be one of two
things, either the value "local", which means that you are
taking full responsibility for ensuring the function is on the page
(however you wish to accomplish that) or a URL to an external file.
In the later case, a <script> tag will be rendered with the src
attribute set to the value you provide here, so it can be any value that
would normally be valid in a <script> tag. Note that if the
value "local" is used, you must take care to ensure that the
handler code appears before the <ajax:enable> tag!
Attributes: None. |
ajaxConfig/group | This element defines a group of AJAX-enabled elements. A group will
most usually represent a single JSP page, but this is NOT a requirement!
You can create arbitrary groups as you see fit.
Attributes:
|
ajaxConfig/group/errorHandler | This element defines a handler that will deal with a specific HTTP
response code for all elements within the group. You can define as
many as you like per group, or none at all, but you must only define
one per HTTP response code!
Attributes:
|
ajaxConfig/group/element |
This element represents an element on the page you will attach an AJAX
event to.
Attributes:
|
ajaxConfig/group/element/errorHandler | This element defines a handler that will deal with a specific HTTP
response code for all events within the element. You can define as
many as you like per element, or none at all, but you must only define
one per HTTP response code! Note that if you define a handler here that
handles the same code as a handler defiend at the group level, this
handler definition will override those definitions.
Attributes:
|
ajaxConfig/group/element/event |
This element defines an event that will fire an AJAX request on the
parent element.
Attributes:
|
ajaxConfig/group/element/event/errorHandler | This element defines a handler that will deal with a specific HTTP
response code for this event. You can define as many as you like per
event, or none at all, but you must only define one per HTTP response
code! Note that if you define a handler here that handles the same
code as a handler defiend at the element or group level, this handler
definition will override those definitions.
Attributes:
|
ajaxConfig/group/element/event/requestHandler |
This defines what request handler will be used to service this event.
You must specify one and only one of these per event.
Attributes:
|
ajaxConfig/group/element/event/requestHandler/parameter |
The meaning of this element is specific to the handler being used. See
the "Standard Request/Response Handlers" section below.
Note that even if the handler does not use this, the element must still
be present! It is in that case perfectly valid to have
<parameter/>.
Attributes: None. |
ajaxConfig/group/element/event/responseHandler |
This defines what response handler will be used to service this event.
You can specify multiple response handlers per event, but at least one
must be defined per event.
Attributes:
|
ajaxConfig/group/element/event/responseHandler/parameter |
The meaning of this element is specific to the handler being used. See
the "Standard Request/Response Handlers" section below. Note
that even if the handler does not use this, the element must still be
present! It is in that case perfectly valid to have <parameter/>.
Attributes: None. |
<ajax:event/> |
This is the tag you place IMMEDIATELY after an element on the page you
wish to attach an AJAX event to (it only has to be immediately after it
if you don't use the attachTo attribute).
Attributes:
|
<ajax:enable/> |
This is the tag that MUST be placed AFTER all
<ajax:event/> tags on the page.
Attributes:
|
<ajax:timer/> |
This tag sets up a repeating AJAX event on a timer. Think of things like
periodically refreshing a status update, etc. Note that when you write
the configuration for a timer event, it must always be part of a virtual
form. Also note that if the request handler you declare needs a reference
to an HTML form, the std;QueryString handler for example, then you
MAY NOT use the special value "parent" here! Note
that the default value of the form attribute is in fact
"parent", so an error will occur if you do not override this
value with the name or ID of a real form.
This tag will render two Javascript functions named startXXXX() and stopXXXX(), where XXXX is the ajaxRef, with the slash replaced with an underscore. For example, for ajaxRef "MyPage/MyButton", the functions rendered would be startMyPage_MyButton() and stopMyPage_MyButton(). As their names imply, these allow you to manually start and stop the timed event. Note that if the stop function is called while an AJAX request is in progress, that event will complete, but no further events will fire unless you call the start function. Attributes:
|
<ajax:manual/> |
This tag is used when you just want the AJAX code rendered on the
page but do not want to attach it to any given element. This is good if
you want to do a lot of complex processing around the event, but would
rather not have to write the actual AJAX code and also still keep the
configuration of the event in the ajax-config.xml file.
Also note that if the request handler you declare needs a reference
to an HTML form, the std;QueryString handler for example, then you
MAY NOT use the special value "parent" here! Note
that the default value of the form attribute is in fact
"parent", so an error will occur if you do not override this
value with the name or ID of a real form.
Attributes:
|
Request Handlers | |
std:QueryString |
Constructs a query string and sends it to the specified target.
Requires form reference: Yes Parameter: A comma-separated list of name-value pairs. The name is the parameter that will be submitted, the value is the form element to get the value from. For example: "text1V=text1,text2V=text2" will result in the parameters "text1V" and "text2V" being submitted, with the values of the "text1" and "text2" form fields as their values, respectively. |
std:SendById |
Constructs a query string (or POST body) based on explicit elements
based on DOM ID and sends it to the specified target.
Requires form reference: No Parameter: A comma-separated list. The first element MUST be the type of request to make, either the value "xml" or "querystring". If the value is "xml", then this element must also contain the root node name. In other words, if you want to send XML and you want the root element to be "person", then the first element of this CSV list should be "xml.person". After that, the elements are in the form X.Y, where X is the DOM ID of the element to get the value from, and Y is the property of that element to read. So, you can do "myDiv.innerHTML", or "myDiv.innerText" or "myTextbox.value", or any other accessible property of the element. |
std:SimpleRequest |
Simply submits a request to the server with no data passed along with
the request.
Requires form reference: No Parameter: None. |
std:SimpleXML |
Constructs a simple XML document and sends it to the specified target
as a POST body.
Requires form reference: Yes Parameter: A comma-separated list of name-value pairs, where the first item is the name of the root element. For example: "Person,firstName=text1,lastName=test2" will result in the following XML being constructed: <Person> <firstName>??</firstName> <lastName>??</lastName> </Person> ...where the ?? value of the <firstName> will be the value of the "text1" form field and the ?? value of the <lastName> will be the value of the "text2" form field. |
std:Poster |
Submits values as the POST body of the request. This will obviously
only have meaning if the HTTP method is POST.
Requires form reference: Yes Parameter: A comma-separated list of name-value pairs. The name is the parameter that will be submitted, the value is the form element to get the value from. For example: "text1V=text1,text2V=text2" will result in the parameters "text1V" and "text2V" being submitted, with the values of the "text1" and "text2" form fields as their values, respectively. |
std:FormSender |
Submits the contents of a form via either POST or GET, as simple
request parameters, JSON or XML. When you send the form contents as
JSON or XML, the HTTP method must be POST... GET will not
work! For plain parameters, either GET or POST will work.
Requires form reference: Yes Parameter: One of three values: "parameters", "json" or "xml". The value "parameters" will send the contents of the form as plain old request parameters. "json" will send the contents of the form as JSON, when the base object name is the name of the form. "xml" will send the contents of the form as XML, where the root node is the name of the form. Note that <select> elements that do no have a value selected will not be transmitted. This is true for radio elements as well. |
Response Handlers | |
std:Alerter |
Pops a Javascript alert() box with the body content of the response.
Parameter: None. |
std:CodeExecuter |
This handler assumes the response from the server is a Javascript
snippet and executes it. Note that the response should NOT be
wrapped in <script> tags.
Parameter: None. |
std:IFrameDisplay |
This handler takes the response from the server and writes it to the
document in a named iFrame. This is essentially the same thing as the
std:InnerHTML handler, except that it works with iFrames specifically.
Parameter: The name of an iFrame on the page. Note that this is the value of the iFrame's name attribute, NOT it's DOM ID attribute! This can be a comma-separated list of names, in which case all the iFrames will be populated with the same result. |
std:InnerHTML |
Sets the innerHTML property of a named element to what the server
returns.
Parameter: The DOM ID of an element on the page to update. This can be a comma-separated list of IDs, in which case all the elements will have their innerHTML properties populated with the same result. |
std:DoNothing |
This may seem like a pointless handler, but it really is not, and here's
why... any response received by the server, regardless of what response
handler(s) you use, will be examined for <script> blocks. Any
that are found will be eval()'d. This is useful because it is typical
to return Javascript as an AJAX response and have it executed on the
client. However, because you must always define at least one response
handler per event, if all you want to do is execute returned Javascript,
you still need a response handler for the event, but in effect you don't
want it to do anything. That's exactly what this is for! Note that
this and the std;CodeExecuter are very similar, but the primary
difference is that std:CodeExecuter assumes the response from the server
is Javascript, and executes it, whereas this handler can be used if the
response may or may not be Javascript (or the response may or may not
include Javascript). The other difference is that std:CodeExecuter
does not require the Javascript to be surrounded by <script> tags,
whereas this one would.
Parameter: None. |
std:Redirector |
This handlers assumes the response from the server is a URL, and
redirects the client to it. Alternatively, you can hard-code a URL in
the config file, in which case the response is essentially irrelevent,
although you still may want to use the matchPattern attribute to
conditionally fire this. This handlers is especially useful for things
like session timesouts... You can have a filter that detects a timed
out session and returns the URL to redirect to in that case. Then, for
any AJAX event, configure this as the first response handlers in the
response handler chain, and set a matchPattern that will cause
it to only execute in response to a redirect event (perhaps if the
response begins with "http" for example), or alternatively,
hardcoded the URL to redirect to in the config file, and return some
status messages when the session is timed out that matchPattern looks
for.
Parameter: None, or, the URL to redirect to. If no value is specified, then the response from the server is assumed to be the URL to redirect to. |
std:Selectbox |
This handler populates a <select> element with data returns by the
server. The server process, which you are responsible for, must return
XML in the following form:
<list> <option value="??">????</option> </list> In this structure, ?? is the value attribute of a given <option> element within the <select>, and ???? is the text to go along with the option. Parameter: The DOM ID (or "name", both work) of the <select> element to populate. This can be a comma-separated list of IDs or names, in which case all the <select>'s will be all populated with the same result. |
std:TextboxArea |
Sets the text in a textbox or textarea element.
Parameter: The "name" attribute of the form element to set text for. Note that only elements in the SAME form as the element that fired the event can be set! |
std:WindowOpener |
This handler opens the response from the server in a new window.
Parameter: The parameter is composed of two elements, separated by a tilde (~) character. The first element is the title of the new window. The second element is a comma-separated list of window options. Please Google for the window.open() method to see the options available. |
std:XSLT |
This handler is capable of transforming XML returned by the server to
HTML, or another XML form, or anything else you can do with XSLT.
Note that this handler requires use of the Sarissa library available at
http://sarissa.sourceforget.net
Parameter: A comma-separated list where the first element is the DOM ID of an element on the page where output will be displayed (by setting innerHTML), and the second element is the path of the XML file for the XSL Transform. |
std:FormManipulator |
This handler populates one or more fields in a form. Also, it is
capable of manipulating the properties of the form and the elements
within it. The server process, which you are responsible for, must
return XML in the following form:
<form name="AA"> <formproperty name="BB" value="CC"/> <element name="DD" value="EE"> <property name="FF" value="GG"/> </element> </form> ...where AA must be the name of the form, BB is the name of the form property (e.g., action) and CC it's new value. DD must be the name of the element and EE the value you wish to assign to it. FF is like BB but then for the element's property (e.g., disabled or style.width) and GG the new value for the property. As you can see it is possible to connect properties with a dot as long as it is possible in Javascript to retrieve them with element[prop1][prop2]! Parameter: None. |
Error Handlers | |
std:AlertErrorHandler | Pops a Javascript alert() displaying a message formed by taking the response text and status code from the XMLHttpRequest object that processed the event. |
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |