Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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}"/>

Indicators

...

Code Block
XML
XML
<s:url id="ajaxTest" value="/AjaxTest.action" />

<s:div 
  theme="ajax" 
  href="%{ajaxTest}" 
  startTimerListenTopics="/startTimer" 
  stopTimerListenTopics="/stopTimer" 
  updateFreq="3000" 
  autoStart="false"/>

The div panel shows "Loading..." by default when the request is in process. To customize this text, use the "loadingText" attribute. If an error of any sort occurs, the error will be shown in the div area; to customize the error message, use the "errorText" attribute. If you don't want to display the erro, set "showErrorTransportText" to "false".

...

Code Block
XML
XML
<s:url id="ajaxTest" value="/AjaxTest.action" />

<s:div 
  href="%{ajaxTest}" 
  theme="ajax" 
  errorText="There was an error" 
  loadingText="reloading" 
  updateFreq="5000"/>

If the loaded content contains Javascript code sections, these sections will be executed if the "executeScripts" attribute is set to true.

...

Code Block
HTML
HTML
<div id="div1">Div 1</div>

<s:url id="ajaxTest" value="/AjaxTest.action" />
 
<s:submit 
  type="submit" 
  theme="ajax" 
  value="submit" 
  targets="div1" 
  href="%{ajaxTest}"/>

Submit button using an image:

Code Block
HTML
HTML
<div id="div1">Div 1</div>

<s:url id="ajaxTest" value="/AjaxTest.action" />

<s:submit 
  type="image" 
  theme="ajax" 
  label="Alt Text" 
  targets="div1" 
  src="${pageContext.request.contextPath}/images/struts-rocks.gif" 
  href="%{ajaxTest}"/>

If the submit button is used inside a form (href is not required on this case), the form will be submitted asynchronously:

...