Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To use DOJO, First of all add the DOJO tag directive like this</p> <pre><code>&lt;%@ taglib prefix="sx" uri="/struts-dojo-tags"%&gt; </code></pre> <p>and then add the following line in the head part of your JSP</p> <pre><code>&lt;sx:head debug="false" cache="false" compressed="true" /&gt; </code></pre> <p>Then listen the event from the struts tag on which you want to apply the ajax as follows</p> <pre><code>&lt;s:radio label="Radio" name="rad" list="list2" onchange="show_details();" &gt;&lt;/s:radio&gt; </code></pre> <p>catch this event in javascript and publish the topic as follows</p> <pre><code>&lt;script&gt; function show_details() { dojo.event.topic.publish("show_detail"); } &lt;/script&gt; </code></pre> <p>And listen the published topic on the same JSP by struts div tag</p> <pre><code>&lt;sx:div showLoadingText="false" id="details" href="DetailAction" theme="ajax" listenTopics="show_detail" formId="frm_demo"&gt;&lt;/sx:div&gt; </code></pre> <p>The argument "show_detail" in the script call and div tag's listenTopics attribute should match exactally. That div will listen the topic and pick up the href attribute and matches with the action in struts.xml </p> <pre><code>&lt;action name="DetailAction" class="ajaxdemo.action.DetailAction"&gt; &lt;result&gt;/Detail.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>It will call your action class <code>ajaxdemo.action.DetailAction</code></p> <p>and selects the values according to the value given by radio button and renders the following JSP Detail.jsp</p> <pre><code>&lt;%@ taglib prefix="s" uri="/struts-tags"%&gt; &lt;s:if test="lstList != null"&gt; &lt;s:select list="lstList"&gt;&lt;/s:select&gt; &lt;/s:if&gt; </code></pre> <p>and places the out put where you have defined your div tag in your main JSP</p> <p>You can also view the detail example on <a href="http://java-tale.blogspot.com/2010/07/using-dojo-for-ajax-call-in-struts-20.html" rel="nofollow noreferrer">java-tale.blogspot.com</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload