AjaxTags 1.3 / Struts2 / Display Tag

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

AjaxTags 1.3 / Struts2 / Display Tag

dynamicd
I am thinking of using Ajax Tags with Display tag in Struts2.
Has anyone tried this ?
Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

dynamicd
After some long hours I got pagination and export working with ajaxtags and displaytag
THis is how you do ajax pagination.

AjaxTags 1.3 rc7
Struts2.0.12
DisplayTag 1.1.1


I had to make small change in the ajaxtags.js for it to work
Comment out the line that calls the prefunction in the ajaxtags.js

/**
 * Prefunction Invoke Ajax.Update TAG
 */
AjaxJspTag.PreFunctionUpdateInvoke = Class.create();
AjaxJspTag.PreFunctionUpdateInvoke.prototype = Object.extend(new AjaxJspTag.Base(), {

  initialize: function(ajaxupdateData) {
/**
  this.preFunction = ajaxupdateData.preFunction;
  if (isFunction(this.preFunction))
  {
  this.preFunction();
  }
  */
  if (this.cancelExecution) {
  alert("I am canceling the excution");
            this.cancelExecution = false;
            return ;
      }    
/**
 * alert("Here I am in  PreFunction Ajaxupdatedata"+ ajaxupdateData.id + " " + ajaxupdateData.href + " " + ajaxupdateData.postFunction  + " prefunction" + this.preFunction);
 */
 
  var thisCall = new Ajax.Updater(ajaxupdateData.id,ajaxupdateData.href,{onComplete: ajaxupdateData.postFunction});
  }

});


Add this to the head section of the page in this order

<script type="text/javascript" src="js/prototype.js"></script><script type="text/javascript" src="js/scriptaculous.js"></script><script type="text/javascript" src="js/ajaxtags.js"></script>
In the jsp page for me which is seperate from the indexpage

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
 <%@ taglib uri="http://ajaxtags.org/tags/ajax" prefix="ajax" %>

<s:div id="userpage">

<form id="userform" method="POST">

  <ajax:displayTag id="userList" ajaxFlag="userList">

  <display:table name="userList" uid="userlist" class="table" export="true" excludedParams="*" pagesize="15" requestURI="/Dashboard/ViewAllUsers.action">
  <display:column media="html"> <s:checkbox name="selectedItems" theme="simple" fieldValue="%{#attr.userlist.id}" ></s:checkbox></display:column>
  <display:column property ="username" title="Username" escapeXml="true" ></display:column>
  <display:column property ="email" title="Email" escapeXml="true" ></display:column>
  <display:column property ="domain" title="SMTP Server Address" escapeXml="true" ></display:column>
  <display:column property ="role" title="Role" escapeXml="true"></display:column> 
  <display:column property ="group.name"   title="Group" escapeXml="true"></display:column> 
   
  </display:table>

</ajax:displayTag>
</form>

<s:url id="deleteuser" value="/Dashboard/deleteUser.action" />
<s:a indicator="indicator" href="%{deleteuser}" showLoadingText="false" id="deleteUser" cssClass="anchors" theme="ajax" targets="users" formId="userform">Delete</s:a>

</s:div>

One thing to note here is that do not use s:form use form instead. s:form create a Table and when the ajax call happens it will refresh a different div in the table and you will see 2 divs

When you look at the page source you will see the links ajaxified as one below
a onclick="new AjaxJspTag.PreFunctionUpdateInvoke({id: "userList", href: "/ViewAllUsers.action?d-3610194-p=2&userList=true" }); return false;" href="javascript://nop/">Next</a

I havent been able to ajaxify sorting yet. If I fig it out I will post the solution
Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

vikpan
Hello Sir

This mail is regarding your posting on the topic "AjaxTags 1.3 / Struts2 / Display Tag " (pagination in struts2 using ajax display tags) please kindly help me in the same by providing the complete steps to be followed .
Presently i included these jar files in the WEB-INF/lib folder
AjaxTags 1.3 rc7
DisplayTag 1.1.1
 and followed the code u had posted in the forum .
But i'm gettin the followin error on deploying the same
"javax.servlet.ServletException: /jsp/pagination.jsp(28,0) Unable to load tag handler class "org.ajaxtags.tags.AjaxDisplayTag" for tag "ajax:displayTag""

Pls reply soon its urgent

Regards
Vikram
Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

dynamicd

Make sure the library is in the class path.

Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

vikpan
Ya i did n now that error is resolved but that ajax functionality is not to be seen during pagination.. i did comment the lines as u had said in ajaxtags.js n when i deploy it on Tomacat the pagination does come but below it comes sayin " Done with errors in page"  n the error is related some dojo.
N when i c the source the lines u had pasted that  are to be expected or not seen as well ..How to resolve this dojo error ?
Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

suhasini
In reply to this post by dynamicd
i followed what u said code there. But i am getting this Exception...
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: au/id/jericho/lib/html/Segment
        org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:397)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

Please help me.
Reply | Threaded
Open this post in threaded view
|

Re: AjaxTags 1.3 / Struts2 / Display Tag

sree
I am getting the same error :
java.lang.ClassNotFoundException: au.id.jericho.lib.html.Segment

Please help