...
Tip |
---|
To use the Ajax tags you need to set the "theme" attribute to "ajax". Use the head tag to configure the page for the ajax theme. Set the "debug" attribute of the head tag to "true" to display debug information on the bottom of the page. |
General Information |
|
---|---|
The AJAX tags share a set of common attributes. | |
How to prevent or cancel a request. | |
How to indicate an AJAX request is processing. | |
Use JavaScript to publish or listen to DOJO topics. | |
The URLs of AJAX tags must be built with the <s:url.../> tag! |
Basic Ajax Tags |
|
---|---|
Creates a content area that can load its content via Ajax, optionally refreshing. | |
Updates element(s) or submits a form via Ajax. | |
Updates element(s) via Ajax. | |
Creates a tabbed panel containing static or dynamic <s:div.../> tab contents. | |
Autocompleter tag providing suggestions or updating elements based on current value. |
...
Attribute | Description | Type |
---|---|---|
href | url used to make the request | String |
listenTopics | A comma separated list of topics names, which will cause the tag to reload its content (Div, Autocompleter), or perform an action (Anchor, Submit) | String |
notifyTopics | A comma separated list of topics names, published by the tag, parameters "data", "type" and "request" will be passed. See each tag for details. | String |
showErrorTransportText | Sets whether or not error messages should be displayed ("true" by default) | Boolean |
indicator | The id of an element that will be displayed while a request is in progress | String |
Anchor | ||||
---|---|---|---|---|
|
Preventing a request
The third parameter of "notifyTopics", request, has a "cancel" property that can be used to prevent a request.
...
Code Block | ||||
---|---|---|---|---|
| ||||
dojo.event.topic.subscribe("/request", function(data, type, request) { //cancel request request.cancel= true; }); <s:url id="ajaxTest" value="/AjaxTest.action" /> <s:submit type="submit" theme="ajax" value="submit" notifyTopics="/request" href="%{ajaxTest}"/> |
Anchor | ||||
---|---|---|---|---|
|
Indicators
Use indicators to notify the user that a request is in progress. The indicator should be hidden when the page is loaded.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<img style="display:none" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..."/> |
Anchor | ||||
---|---|---|---|---|
|
Topics
Topics provide an easy way to listen to and publish events.
...
Code Block | ||||
---|---|---|---|---|
| ||||
dojo.event.topic.publish("/refresh", "foo", "bar"); |
Anchor | ||||
---|---|---|---|---|
|
URL
The "href" attribute must contain a url built with the url tag.
...
Warning | ||||
---|---|---|---|---|
| ||||
None of the ajax tags will work if their url (in the "href" attribute) is not built with the url tag. |
Anchor | ||||
---|---|---|---|---|
|
Returning pages with AJAX Tags
...