struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sharath karnati <karna...@yahoo.com>
Subject Using <s:a> Ajax tag with struts2.0.11
Date Thu, 06 Aug 2009 15:23:17 GMT
Hi All,
 
    Say I have COMPLAINT table as below
 
----------------------------------------------------------------------------
 
<div id="div1">
<table class="datatab" cellpadding="0" cellspacing="5" width="95%">
<thead> 
<tr align="left"> 
<th> 
<c:choose>
<c:when test="${sort_by == 'complaint_id'}"> 
<s:url id="complaintLink1" action="complaints!listWithAjax" includeParams="none">
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{other_order}"/> 
</s:url>

<s:a id="complaintId1" href="%{complaintLink1}" cssClass="sort_header" theme="ajax" targets="div1"
errorText="An error ocurred" loadingText="Loading...">
Complaint ID<img border="0" src="images/sort_${sort_order}.gif" />
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{other_order}"/>
</s:a> 
</c:when>
<c:otherwise>
<s:url id="complaintLink2" action="complaints!listWithAjax" includeParams="none">
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{'asc'}"/> 
</s:url>
<s:a id="complaintId2" href="%{complaintLink2}" cssClass="sort_header" theme="ajax" targets="div1"
errorText="An error ocurred" loadingText="Loading...">
Complaint ID
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{'asc'}"/>
</s:a> 
</c:otherwise>
</c:choose> 
</th> 
<th>
<c:choose>
<c:when test="${sort_by == 'first_name'}">
<a class="sort_header" href="javascript:sortResults('openForm', 'first_name', '${other_order}')">
Consumer Name<img border="0" src="images/sort_${sort_order}.gif" />
</a>
</c:when>
<c:otherwise>
<a class="sort_header" href="javascript:sortResults('openForm', 'first_name', 'asc')">
Consumer Name
</a>
</c:otherwise>
</c:choose>
</th> 
<th>
<c:choose> 
<c:when test="${sort_by == 'submission_date'}">
<a class="sort_header" href="javascript:sortResults('openForm', 'submission_date', '${other_order}')">
Submission Date<img border="0" src="images/sort_${sort_order}.gif" />
</a>
</c:when>
<c:otherwise>
<a class="sort_header" href="javascript:sortResults('openForm', 'submission_date', 'asc')">
Submission Date
</a>
</c:otherwise>
</c:choose>
</th>

 

</tr>
</thead>

<s:iterator value="complaint_list" id="complaint">
<tr>
<td>
<s:url id="complaintLink" action="manageForm" includeParams="none">
<s:param name="complaint_key" value="%{user_complaint_key}"/>
<s:param name="form_type" value="%{form_type}"/> 
</s:url>
<s:a href="%{complaintLink}">
<s:property value="user_complaint_key" />
</s:a>
</td> 
<td>
<s:property value="first_name" />
<s:property value="last_name" />
</td> 
<td>
<s:date name="submission_date" format="MM/dd/yyyy" />
</td>
</tr>
</s:iterator> 
</table>
</div>
-------------------------------------
 
  Added ajax call in the below way
 
   
<s:url id="complaintLink2" action="complaints!listWithAjax" includeParams="none">
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{'asc'}"/> 
</s:url>
<s:a id="complaintId2" href="%{complaintLink2}" cssClass="sort_header" theme="ajax" targets="div1"
errorText="An error ocurred" loadingText="Loading...">
Complaint ID
<s:param name="sort_by" value="%{'complaint_id'}"/>
<s:param name="sort_order" value="%{'asc'}"/>
</s:a> 

 
 When user selects 'Complaint ID' column header,  it is calling 'listWithAjax' method in
'complaints' action but it is not refreshing 'div1' values. It is not even showing table header
columns.  In page header added <s:head theme="ajax" debug="true"/>
 
 The 'listWithAjax' method is populating list 'complaint_list' of values in action but these
are not avilable in response, can anyone let me know how to retrieve values in ajax request?
what I'm doing wrong?
 
  Thanks in advance.
 
Regards,
Sharath.


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message