« Return to Thread: Reverse Ajax Problem

Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View in Thread

Also, in later versions of DWR it is preferred to use the following for scalability:
 
import org.directwebremoting.ScriptSessions;
import org.directwebremoting.Browser;
 
final Object[] args = ...;
Browser.withCurrentPage(new Runnable() {
   public void run() {
      ScriptSessions.addFunctionCall("someFunction", args);
   }
});
 
Cheers,
Lance.

2009/11/6 Lance Java <lance.java@...>
This *seems* ok depending on how it is invoked... the use of static fields scares me a bit. What is the size() of sessions?
   Collection sessions = wctx.getScriptSessionsByPage(currentPage);

2009/11/6 Pavan T <pavan_t@...>

Hi,

 

Thanks for your reply

 

Following is the server side code

 

public class Service{

 

            private static List<ClientServiceFormBean> servicesDetails=null;

            private static int previous=0;

            private static int next=0;

            private static int initial=0;

 

 

            public static List<ClientServiceFormBean> getServicesDetails() {

                        return servicesDetails;

            }

 

            public static void setServicesDetails(

                                    List<ClientServiceFormBean> servicesDetails) {

                        Service.servicesDetails = servicesDetails;

            }

 

            public void getServices() throws InterruptedException{

 

                        System.out.println("inside get services");

 

                        ResourceBundle resource=ResourceBundle.getBundle("provgui_menu_items");

                        String displayRecords=resource.getString("totalRecords");

                        initial=Integer.parseInt(displayRecords);

                        next=initial-1;

                        previous=next;

                        next+=initial;

 

 

                         WebContext wctx = WebContextFactory.get();

                         String currentPage = wctx.getCurrentPage();

                         Collection sessions = wctx.getScriptSessionsByPage(currentPage);

                         Util utilAll = new Util(sessions);

 

            List<ClientServiceFormBean> services=new ArrayList<ClientServiceFormBean>();

                        int size=servicesDetails.size();

                        System.out.println("size of servicesDetails : "+size);

            for(int i=0;i<(size/initial)-1;i++){

                        System.out.println("previous: "+previous+" Next : "+next+" i: "+i);

                        List<ClientServiceFormBean> records=new ArrayList<ClientServiceFormBean>();

                        Thread.sleep(4000);

                        for(;previous<next;previous++){

                                    records.add(servicesDetails.get(previous));

                        }

                        previous=next;

                        next+=initial;

                        System.out.println("sending records....."+records.size());

 

                        utilAll.addFunctionCall("fillTable",records);

 

             }

 

}

}

 

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.



 « Return to Thread: Reverse Ajax Problem