Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor nav update.

...

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

 

Common AJAX Tag Attributes

The AJAX tags share a set of common attributes.

Preventing/Canceling a Request

How to prevent or cancel a request.

Request Indicators

How to indicate an AJAX request is processing.

DOJO Topics

Use JavaScript to publish or listen to DOJO topics.

AJAX Urls

The URLs of AJAX tags must be built with the <s:url.../> tag!

Basic Ajax Tags

 

<s:div>

Creates a content area that can load its content via Ajax, optionally refreshing.

<s:submit>

Updates element(s) or submits a form via Ajax.

<s:a> (Anchor)

Updates element(s) via Ajax.

<s:tabbedPanel>

Creates a tabbed panel containing static or dynamic <s:div.../> tab contents.

<s:autocompleter>

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
preventingRequest
preventingRequest

Preventing a request

The third parameter of "notifyTopics", request, has a "cancel" property that can be used to prevent a request.

...

Code Block
HTML
HTML
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
requestIndicators
requestIndicators

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
HTML
HTML
<img style="display:none" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..."/>

Anchor
dojoTopics
dojoTopics

Topics

Topics provide an easy way to listen to and publish events.

...

Code Block
HTML
HTML
dojo.event.topic.publish("/refresh", "foo", "bar"); 

Anchor
ajaxUrls
ajaxUrls

URL

The "href" attribute must contain a url built with the url tag.

...

Warning
URL
URL

None of the ajax tags will work if their url (in the "href" attribute) is not built with the url tag.

Anchor
returningAjaxTags
returningAjaxTags

Returning pages with AJAX Tags

...