NOTE: Ajax template (Dojo plugin) is deprecated and won’t be supported any longer.
Please check that documentation and the Dojo tag examples in the showcase app of the appropriate Struts 2 version before asking questions on the struts-user mailing list!
To use the AJAX tags from 2.1 on you must:
- Include the Dojo Plugin distributed with Struts 2 in your /WEB-INF/lib folder.
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>to your page.
- Include the head tag on the page, which can be configured for performance or debugging purposes.
Handling AJAX Responses
The following attributes affect the handling of all ajax responses.
|Attribute|Default Value|Description| |———|————-|———–| |parseContent|true|When true, Dojo will parse the response into an XHTML Document Object and traverse the nodes searching for Dojo Widget markup. The parse and traversal is performed prior to inserting the nodes into the DOM. This attribute must be enabled to nest Dojo widgets (dojo tags) within responses. There’s significant processing involved to create and parse the document so switch this feature off when not required. Note also that the response must be valid XHTML for cross-browser support and widgets must have unique IDs.| |separateScripts|true|When true, Dojo will extract the
It’s possible that the updated DOM will not include
Ensure the response is XHTML-compliant (including, for example, thead and tbody tags in tables).
- set executeScripts=true,
- set separateScripts=true (the reliable option)
Most of the AJAX tags use Dojo topics for event notification and communication between them, to learn about topics visit Dojo’s documentation