Reverse Ajax Problem

View: New views
11 Messages — Rating Filter:   Alert me  

Reverse Ajax Problem

by Pavan Kumar-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi All,

 

I have Portlet application which is deployed in Liferay 4.3.5 and using Reverse Ajax functionality but my server side class doesn’t invoke the javascript function to display the data.

Following are the things that I have done to enable Reverse Ajax

 

In web.xml

           

<servlet>

     <servlet-name>dwr-invoker</servlet-name>

      <display-name>DWR Servlet</display-name>

      <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>

               

      <init-param>

                 <param-name>debug</param-name>

                 <param-value>true</param-value>

      </init-param>

    <init-param>

            <param-name>activeReverseAjaxEnabled</param-name>

            <param-value>true</param-value>

     </init-param>           

    <load-on-startup>2</load-on-startup>                

</servlet>  

 

In dwr.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd">

 

<dwr>

  <allow>

     <convert converter="bean" match="utils..ClientServiceFormBean"/>

  

     <create creator="new" javascript="Service" scope="application">

         <param name="class" value="utils.Service"/>

    </create>

  </allow>

 </dwr>

 

We are using tiles for the GUI and have mainlayout.jsp which has reference to header.jsp,footer.jsp,menu.jsp and in the body part the respective jsp page changes.

I have added in jsp page the following thing

window.onload=dwr.engine.setActiveReverseAjax(true);

 

The call is going to my server side class utils.Service.java but the data it pushes is not getting displayed.

 

I have also downloaded the src code of dwr and kept SOP statements and have seen the data is flushed to the browser but it is not displaying data.

 

Please let me know the solution to the problem.

 

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com

 

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.


Re: Reverse Ajax Problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pls post the serverside reverse ajax code

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

Hi All,

 

I have Portlet application which is deployed in Liferay 4.3.5 and using Reverse Ajax functionality but my server side class doesn’t invoke the javascript function to display the data.

Following are the things that I have done to enable Reverse Ajax

 

In web.xml

           

<servlet>

     <servlet-name>dwr-invoker</servlet-name>

      <display-name>DWR Servlet</display-name>

      <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>

               

      <init-param>

                 <param-name>debug</param-name>

                 <param-value>true</param-value>

      </init-param>

    <init-param>

            <param-name>activeReverseAjaxEnabled</param-name>

            <param-value>true</param-value>

     </init-param>           

    <load-on-startup>2</load-on-startup>                

</servlet>  

 

In dwr.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr/dwr20.dtd">

 

<dwr>

  <allow>

     <convert converter="bean" match="utils..ClientServiceFormBean"/>

  

     <create creator="new" javascript="Service" scope="application">

         <param name="class" value="utils.Service"/>

    </create>

  </allow>

 </dwr>

 

We are using tiles for the GUI and have mainlayout.jsp which has reference to header.jsp,footer.jsp,menu.jsp and in the body part the respective jsp page changes.

I have added in jsp page the following thing

window.onload=dwr.engine.setActiveReverseAjax(true);

 

The call is going to my server side class utils.Service.java but the data it pushes is not getting displayed.

 

I have also downloaded the src code of dwr and kept SOP statements and have seen the data is flushed to the browser but it is not displaying data.

 

Please let me know the solution to the problem.

 

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com

 

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.



Parent Message unknown RE: Reverse ajax problem

by Pavan Kumar-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

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.


Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.



Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.




Re: Reverse ajax problem

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The class posted by Paven is certainly not thread safe. 

On Fri, Nov 6, 2009 at 3:29 AM, Lance Java <lance.java@...> wrote:
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.





Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hence why I was scared about the statics!

2009/11/6 David Marginian <david@...>
The class posted by Paven is certainly not thread safe. 

On Fri, Nov 6, 2009 at 3:29 AM, Lance Java <lance.java@...> wrote:
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.






Parent Message unknown RE: Reverse ajax problem

by Pavan Kumar-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

The problem with statics is thread safe but why it is not invoking the javascript function and not displaying the data.

Please let me know.

 

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com


From: Pavan T
Sent: Friday, November 06, 2009 11:12 AM
To: 'users@...'
Subject: RE: [dwr-user] Reverse ajax problem

 

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.


Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As I asked before... what is the size() of sessions [Collection sessions = wctx.getScriptSessionsByPage(currentPage);]
Also, is wctx.getCurrentPage() the page that you expect to send data to?
 
The class is not thread safe. Think what would happen if one thread was in the for loop and another thread called setServiceDetails() at the same time.
2009/11/12 Pavan T <pavan_t@...>

Hi,

 

The problem with statics is thread safe but why it is not invoking the javascript function and not displaying the data.

Please let me know.

 

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com


From: Pavan T
Sent: Friday, November 06, 2009 11:12 AM
To: 'users@...'
Subject: RE: [dwr-user] Reverse ajax problem

 

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.



Parent Message unknown RE: Reverse ajax problem

by Pavan Kumar-16 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I have also some more problems. I will explain clearly the scenario that we are trying to achieve. In GUI when we select the drop down box and click on button it will fetch and display the data. The number of records that are displayed are very large and browser is talking much time to display all the records and we have decided to display 200 records at a time using ‘Reverse Ajax’. So the server pushes every 200 records.

We are using Liferay Portal 4.3.5 and using using strutsPortlet application. Intially the code is there in action class of Portlet

 

public class HaulAction extends CommonAction{

 

 

    /** Log4j logging. */

  private static Log logger = LogFactory.getLog(SwitchBackhaulAction.class);

 

 

 public HaulAction() {

 }

 

 

     public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig config,RenderRequest request, RenderResponse response)

                 throws Exception{

 

     {

 

     logger.info("Render Action :" +IConstant.ENTERED);

     String actionName=null;

     String selectedTab=request.getParameter("selectedTab");

     logger.info("Selected Tab :" + selectedTab);

     String forward = "normalSwitchBackhaul";

     //String forward=IConstant.FORWARD_SUCCESS;

     SwitchBackhaulForm switchBackhaulForm=(SwitchBackhaulForm)form;

 

     try{

     request.setAttribute("selectedTab",forward);

     String circuitName=(String)request.getParameter("hiddenLabel");

     System.out.println("circuitName :"+circuitName);

         logger.info("Label in Render Action :" +circuitName);

             SwitchBackhaulHelper helper=new SwitchBackhaulHelper();

     actionName=request.getParameter("Button");

     String reset=request.getParameter("reset");

     String userId=PortletUtil.getUsername(request);

     System.out.println("userId : "+userId);

     PortletSession session=request.getPortletSession();

     boolean forceEnabled;

      if(session.getAttribute("forceEnable",session.APPLICATION_SCOPE)==null){

         forceEnabled=false;

     }else{

         forceEnabled=((Boolean)session.getAttribute("forceEnable",session.APPLICATION_SCOPE)).booleanValue();

     }

      /* Added for Display All Checkbox change */

      //get the role of the Logged in User

      Collection roles=(Collection)session.getAttribute("roles",session.APPLICATION_SCOPE);

      //chk if the logged in user is Super user or not

      if(null != roles && roles.contains("PROVGUISUPER")){

      //set the user as an Super User in the form

      switchBackhaulForm.setIsSuperUser("true");

      logger.debug(" SwitchBackhaulAction : Role of Logged in User is Super User");

      }else{

      //set the user as not an Super User in the Form

      switchBackhaulForm.setIsSuperUser("false");

      logger.debug(" SwitchBackhaulAction : Role of Logged in User is not Super User");

      }

 

      /* End of Addition */

 

      List<CustomerInfo> customerList=null;

     //populate customer list

   if(reset!=null && reset.equals("true"))

   {

        customerList=helper.getCustomers(userId);

        Collections.sort(customerList);

        switchBackhaulForm.setCustomerNames(customerList);

        logger.info(" got customers  " + customerList.size());

        switchBackhaulForm.setClientServiceList(null);

        //make a call to helper to get the Filter inputs

        helper.getFilterInputs(userId,switchBackhaulForm);

        forward="customerSuccess";

   }

 

 

     logger.info("Clicked on Action :" + actionName);

 

     ArrayList<ServiceInfo> filterServices=null;

 

     if(actionName==null)

     {

     logger.info("cleaning session ");

         cleanSession(request);

     }

     while(actionName!=null){

         if(actionName.equals("Fetch")){

                 logger.info("Fetch Circuits Action :" + IConstant.ENTERED);

                 /* Added Change By Sukanta dey for SVC Layer*/

                 helper.getCircuits(switchBackhaulForm,userId);

                 /* Change End */

                 List ipProfiles=helper.getAllIpProfiles(userId);

                 logger.info("Fetch Circuits Action :" + IConstant.EXITED);

 

             break;

          }

 

 

                 if(actionName.equals("Get Services")){

                  String forceEnabledCheckbox=request.getParameter("forceEnabledCheckbox");

                  System.out.println("forceEnabledCheckbox : "+forceEnabledCheckbox);

                  if(forceEnabledCheckbox!=null){

                     forceEnabled=Boolean.parseBoolean(forceEnabledCheckbox);

                     session.setAttribute("forceEnable",forceEnabled,PortletSession.APPLICATION_SCOPE);

                  }

                  logger.info("Get Services Action :" + IConstant.ENTERED);

                 boolean showDisconnectCheckbox=switchBackhaulForm.getShowDisconnectCheckbox();

                 String [] selectedFrom=request.getParameterValues("selectedFromCircuit");

                 System.out.println("selectedFrom : ");

                 for(int i=0;i<selectedFrom.length;i++){

                 System.out.print(selectedFrom[i]+",");

                 }

                 if(showDisconnectCheckbox){

                  if(selectedFrom != null && selectedFrom.length > 1){

                     logger.info("***Checkbox value is True***" + selectedFrom[0]);

                     switchBackhaulForm.setSelectedFromCircuit(selectedFrom[0]);

                 }

                 }

                 else{

                 if(selectedFrom != null && selectedFrom.length > 1){

                     logger.info("***Checkbox value is False***" + selectedFrom[1]);

                     switchBackhaulForm.setSelectedFromCircuit(selectedFrom[1]);

                 }

                 }

                 selectedFrom=null;

                 /* Added for Display all checkbox change */

                 //get the status of the displayAll checkbox

                 boolean displayAllCheckbox=switchBackhaulForm.isDisplayAllCheckbox();

                 //collect the values of checkboxes

                 String [] selectedTo=request.getParameterValues("selectedToCircuit");

                 System.out.println("selectedTo : ");

                 for(int i=0;i<selectedTo.length;i++){

                 System.out.print(selectedTo[i]+",");

                 }                   

                 //chk the vallue of checkbox

                 if(displayAllCheckbox){

                 if(null != selectedTo && selectedTo.length > 1){

                     logger.info("*** Display All Checkbox value is True ***" + selectedTo[0]);

                     //if checkbx is checked get the circuit from total circuits

                     switchBackhaulForm.setSelectedToCircuit(selectedTo[0]);

                 }

                 }

                 else{

                        if(null != selectedTo && selectedTo.length > 1){

                     logger.info("*** Display All Checkbox value is False ***" + selectedTo[1]);

                     //if checkbx is not checked get the circuit from matching circuits

                     switchBackhaulForm.setSelectedToCircuit(selectedTo[1]);

                 }

                 }

                 //make the string array null

                 selectedTo=null;

 

                 /* End of Addition */

             String circuitId=switchBackhaulForm.getSelectedFromCircuit();

             logger.info("Circuit ID :" + circuitId);

             PortletContext portletContext=request.getPortletSession().getPortletContext(); //to get CPE Encap HashMap.

             filterServices=helper.getFilterServicesList(switchBackhaulForm,circuitId,portletContext,userId);

             List<ClientServiceFormBean> serviceDetail=helper.getSidsByCircuit(switchBackhaulForm,filterServices,circuitName);

            request.setAttribute("details",serviceDetail);

           

            filterServices=null;

                  System.out.println("set all the records....");

             logger.info("Get Services :" + IConstant.EXITED);

             break;

 

 

         }

 

      }

 

     }

 

     catch(Exception e)

     {

 

                  StringWriter sw = new StringWriter();

         e.printStackTrace(new PrintWriter(sw));

         logger.error("Exception occured in Switch Backhaul Action :" + sw.toString());

     ActionErrors actionErrors = new ActionErrors();

                  ActionMessage searchEntryError = null;

                  searchEntryError = new ActionMessage(IConstant.ERROR_COMMON,e.getMessage());

                  actionErrors.add(IConstant.PROVISIONING_EXCEPTION_ERROR_KEY,searchEntryError);

                  saveErrors(actionErrors, request);

            }

 

         logger.info("Render Action : " + IConstant.EXITED);

 

         return mapping.findForward(forward);

 

 

 }

 

 

 

 }

 

}

This HaulAction gets called when we click on the button and the if condition gets executed and return all the records to the browser.Now in order to use reverse ajax I have refactored the code to remote class

public class SwitchBackHaulService implements Runnable{

 

      private static String FUNCTION_NAME="fillTable";     

      private ServerContext sctx;

      private WebContext wctx;

     

     

      public SwitchBackHaulService() {

            wctx=WebContextFactory.get();

            ServletContext servletContext = wctx.getServletContext();

        sctx = ServerContextFactory.get(servletContext);

        System.out.println("SwitchBackHaulService created");

      }

 

 

      public void run() {

            getData();

      }

 

     

      private void getData(){

            List<ClientServiceFormBean> servicesDetails=fillServices();

            String currentPage = "/html/portlet/provisioning-webapp/switchbackhaul.jsp";

            Collection<ScriptSession> sessions = sctx.getScriptSessionsByPage(currentPage);

            Util util = new Util(sessions);

           

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

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

            int batch=Integer.parseInt(displayRecords);

           

            int fromIndex = 0;

            int toIndex = 0;

            int size = servicesDetails.size();

            for (int i=0; i<size/batch; i++) {

                  List<ClientServiceFormBean> records= getRecordsToDisplay(servicesDetails,fromIndex,toIndex);

                  fromIndex=toIndex;

                  toIndex+=batch;

                  util.addFunctionCall(FUNCTION_NAME, records);

            }

           

      }

 

      /**

       * Getting Data from provgui_backend

       *

       */

      private List<ClientServiceFormBean> fillServices(){

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

            System.out.println("Inside fillServices");

            // the attributes which we got from RenderRequest now getting from HttpServletRequest

            ServletContext context= wctx.getServletContext();

            HttpServletRequest request=wctx.getHttpServletRequest();

            // the attributes which we got from PortletSession now getting from session

            HttpSession session=wctx.getSession();

            SwicthBackHaulForm switchBackHaulForm=( SwicthBackHaulForm)session.getAttribute(“swicthBackHaulForm”);

 

        String forceEnabledCheckbox=request.getParameter("forceEnabledCheckbox");

        System.out.println("forceEnabledCheckbox : "+forceEnabledCheckbox);

        if(forceEnabledCheckbox!=null){

           boolean forceEnabled=Boolean.parseBoolean(forceEnabledCheckbox);

           //session.setAttribute("forceEnable",forceEnabled,PortletSession.APPLICATION_SCOPE);

           session.setAttribute("forceEnable",forceEnabled);

        }

 

        // Commenting formBean needs to uncomment later

       //boolean showDisconnectCheckbox=switchBackhaulForm.getShowDisconnectCheckbox();

       String [] selectedFrom=request.getParameterValues("selectedFromCircuit");

       System.out.println("selectedFrom : ");

       for(int i=0;i<selectedFrom.length;i++){

            System.out.print(selectedFrom[i]+",");

       }

       // Commenting formBean needs to uncomment later

       if(showDisconnectCheckbox){

            if(selectedFrom != null && selectedFrom.length > 1){

           switchBackhaulForm.setSelectedFromCircuit(selectedFrom[0]);

       }

       }

       else{

            if(selectedFrom != null && selectedFrom.length > 1){

           switchBackhaulForm.setSelectedFromCircuit(selectedFrom[1]);

       }

       }

       selectedFrom=null;

       /* Added for Display all checkbox change */

       //get the status of the displayAll checkbox

      

    // Commenting formBean needs to uncomment later

       //boolean displayAllCheckbox=switchBackhaulForm.isDisplayAllCheckbox();

       //collect the values of checkboxes

       String [] selectedTo=request.getParameterValues("selectedToCircuit");

       System.out.println("selectedTo : ");

       for(int i=0;i<selectedTo.length;i++){

            System.out.print(selectedTo[i]+",");

       }     

       // Commenting formBean needs to uncomment later

       //chk the vallue of checkbox

       if(displayAllCheckbox){

            if(null != selectedTo && selectedTo.length > 1){

           //if checkbx is checked get the circuit from total circuits

           switchBackhaulForm.setSelectedToCircuit(selectedTo[0]);

       }

       }

       else{

            if(null != selectedTo && selectedTo.length > 1){

           //if checkbx is not checked get the circuit from matching circuits

           switchBackhaulForm.setSelectedToCircuit(selectedTo[1]);

       }

       }

       //make the string array null

      selectedTo=null;

 

       /* End of Addition */

    // Commenting formBean needs to uncomment later

       String circuitId=switchBackhaulForm.getSelectedFromCircuit();

 

   //Needs to verify whether usedId can be fetched from HttpServletRequest

   String userId=PortletUtil.getUsername(request);

   System.out.println("userId : "+userId);

 

   String circuitName=(String)request.getParameter("hiddenLabel");

   System.out.println("circuitName :"+circuitName); 

   //Needs to look at the following code

   try {

      SwitchBackhaulHelper helper=new SwitchBackhaulHelper();

} catch (Exception e) {

      // TODO Auto-generated catch block

      e.printStackTrace();

}

   //PortletContext portletContext=request.getPortletSession().getPortletContext(); //to get CPE Encap HashMap.

   //Assuming ServletContext will work

   ServletContext portletContext=wctx.getServletContext();

   HashMap encapMap=(HashMap)portletContext.getAttribute("cpeEncapMap");

   System.out.println("encapMap : "+encapMap);

  

   // Commenting formBean needs to uncomment later

   ArrayList<ServiceInfo> filterServices=getFilterServicesList(switchBackhaulForm,circuitId,portletContext,userId);

   List<ClientServiceFormBean> serviceDetail=helper.getSidsByCircuit(switchBackhaulForm,filterServices,circuitName);

 

   return serviceDetail;

}    

 

      private List<ClientServiceFormBean> getRecordsToDisplay(List<ClientServiceFormBean> servicesDetails,int fromIndex,int toIndex){

            return      servicesDetails.subList(fromIndex, toIndex);

      }

     

      public void getServices(){

            new Thread(this).start();          

      }

 

    private ArrayList<ServiceInfo> getFilterServicesList(SwitchBackhaulForm form, String circuitId,ServletContext portletContext,String userId) throws Exception {

      

      ProvisioningServerBusinessDelegate delegate=new ProvisioningServerBusinessDelegate();;

        HashMap encapMap=null;

        if(portletContext.getAttribute("cpeEncapMap")==null){

            //Make a call to SI to get CPE Encap HashMap.

            encapMap=delegate.getCPEEncapMap(userId);

            System.out.println("encapMap : "+encapMap);

            portletContext.setAttribute("cpeEncapMap",encapMap);

        }else{

            encapMap=(HashMap)portletContext.getAttribute("cpeEncapMap");

        }

       

        long switchId=Long.parseLong(circuitId.trim());

        Long ipType=null;

        Long noOfIp=null;

        Long noOfSids=null;

 

        String ipProfile=form.getSelectedIpProfile();

        if (!(ipProfile.equals("-1"))) {

           ipType=new Long(ipProfile);

        }

        String serviceCategory=form.getSelectedServiceCategory();

        String serviceClass=form.getSelectedServiceClass();

        boolean isDisconnected = form.getIsDisconnected();

 

        if (serviceCategory.equals("-1")) {

            serviceCategory=null;

        }

 

 

        if(serviceClass.equals("-1")){

          serviceClass=null;

        }

 

 

        String numOfIp=form.getNumOfIp();

        String numOfSids=form.getNumOfSids();

 

        if (numOfIp.equals("")) {

            noOfIp=null;

        } else {

            noOfIp=new Long(numOfIp);

        }

        if (numOfSids.equals("")) {

            noOfSids=null;

        } else {

            noOfSids=new Long(numOfSids);

        }

        ArrayList<ServiceInfo> nonFilterList = delegate.getSidsByCircuit(switchId, ipType, serviceCategory, serviceClass, noOfIp, noOfSids, isDisconnected,userId);

            ArrayList<ServiceInfo> filterServicesList=new ArrayList<ServiceInfo>();

            for(ServiceInfo serviceInfo : nonFilterList){               

                String serviceType=serviceInfo.getServiceType()!=null ? serviceInfo.getServiceType().toString() : null;

            if (serviceInfo.getServiceClass().equals("GENERIC") || (serviceType!=null  && (serviceType.equals("DATA") ||serviceType.equals("SECONDARY_DATA") || serviceType.equals("VOICE") || serviceType.equals("VPN")))) {

                        /* Adding encapsulation Type Name into the dto to display in jsp */

                        String cpeEncapType = (String) encapMap.get(serviceInfo.getCpeEncapId());

                        serviceInfo.setCpeEncapType(cpeEncapType);

                    filterServicesList.add(serviceInfo);

                }

            }

            nonFilterList=null;

            return filterServicesList;

         } 

}

Now my questions are

1.                   The code needs to get SwitchBackHaulForm which contains data.I have used struts creator and able to get the SwitchBackHaulForm but with empty data.The SwitchBackHaulForm doesn’t get populated with request parameters.How can I do it?

2.                   The refactored code or the code in remote class (SwitchBackHaulService.java) needs to access the attributes in PortletRequest,PortletSession and PortletContext.I have tried to get it fromHttpSession and ServletContext they are coming as null.How can I access the attributes in PortletRequest,PortletSession and PortletContext?

3.                   We are using tiles for UI(the mainLayout.jsp will have reference to header.jsp,footer.jsp and body.jsp ) and if I hard code the body.jsp page where I need to send the data the size of the session is coming as null.If I am coding in this way String currentPage=webcontext.getCurrentPage(); the size of the session is not null but the current page is not as expected this might be because of tiles layout.How can I give the correct value of the jsp page in case of tiles?

Please let me know.

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com


From: Pavan T
Sent: Thursday, November 12, 2009 5:06 PM
To: 'users@...'
Subject: RE: [dwr-user] Reverse ajax problem

 

Hi,

 

The problem with statics is thread safe but why it is not invoking the javascript function and not displaying the data.

Please let me know.

 

Thanks,

Pavan T | Software Engineer | Persistent Systems Limited
pavan_t@... | Tel: +91 (20) 3023 4150
Innovation in software product design, development and delivery -  www.persistentsys.com


From: Pavan T
Sent: Friday, November 06, 2009 11:12 AM
To: 'users@...'
Subject: RE: [dwr-user] Reverse ajax problem

 

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.


Re: Reverse ajax problem

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok... this seems wrong to me
 
String currentPage = "/html/portlet/provisioning-webapp/switchbackhaul.jsp";
Collection<ScriptSession> sessions = sctx.getScriptSessionsByPage(currentPage);
getScriptSessionsByPage() works on the current URL that is displayed in the user's address bar... not some JSP that struts is forwarding to. You probably want to do something like:
 
String currentPage = "/foo/bar/mainPage.do";
Collection<ScriptSession> sessions = sctx.getScriptSessionsByPage(currentPage);
 
I have never used the struts creator and I don't really agree with the principle of it. You are much better to write a shared service that is called by your struts action and your remote DWR object. This service will not have any reference to request/portletRequest/httpSession etc. Your struts actions will get values from request parameters / session attributes. DWR methods get them from method arguments / session attributes. Both pass the values to the shared service. Makes your service much easier to unit test too.
 
 
 
 
 
 

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

Hi,

 

I have also some more problems. I will explain clearly the scenario that we are trying to achieve. In GUI when we select the drop down box and click on button it will fetch and display the data. The number of records that are displayed are very large and browser is talking much time to display all the records and we have decided to display 200 records at a time using ‘Reverse Ajax’. So the server pushes every 200 records.

We are using Liferay Portal 4.3.5 and using using strutsPortlet application. Intially the code is there in action class of Portlet

 

public class HaulAction extends CommonAction{

 

 

    /** Log4j logging. */

  private static Log logger = LogFactory.getLog(SwitchBackhaulAction.class);

 

 

 public HaulAction() {

 }

 

 

     public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig config,RenderRequest request, RenderResponse response)

                 throws Exception{

 

     {

 

     logger.info("Render Action :" +IConstant.ENTERED);

     String actionName=null;

     String selectedTab=request.getParameter("selectedTab");

     logger.info("Selected Tab :" + selectedTab);

     String forward = "normalSwitchBackhaul";

     //String forward=IConstant.FORWARD_SUCCESS;

     SwitchBackhaulForm switchBackhaulForm=(SwitchBackhaulForm)form;

 

     try{

     request.setAttribute("selectedTab",forward);

     String circuitName=(String)request.getParameter("hiddenLabel");

     System.out.println("circuitName :"+circuitName);

         logger.info("Label in Render Action :" +circuitName);

             SwitchBackhaulHelper helper=new SwitchBackhaulHelper();

     actionName=request.getParameter("Button");

     String reset=request.getParameter("reset");

     String userId=PortletUtil.getUsername(request);

     System.out.println("userId : "+userId);

     PortletSession session=request.getPortletSession();

     boolean forceEnabled;

      if(session.getAttribute("forceEnable",session.APPLICATION_SCOPE)==null){

         forceEnabled=false;

     }else{

         forceEnabled=((Boolean)session.getAttribute("forceEnable",session.APPLICATION_SCOPE)).booleanValue();

     }

      /* Added for Display All Checkbox change */

      //get the role of the Logged in User

      Collection roles=(Collection)session.getAttribute("roles",session.APPLICATION_SCOPE);

      //chk if the logged in user is Super user or not

      if(null != roles && roles.contains("PROVGUISUPER")){

      //set the user as an Super User in the form

      switchBackhaulForm.setIsSuperUser("true");

      logger.debug(" SwitchBackhaulAction : Role of Logged in User is Super User");

      }else{

      //set the user as not an Super User in the Form

      switchBackhaulForm.setIsSuperUser("false");

      logger.debug(" SwitchBackhaulAction : Role of Logged in User is not Super User");

      }

 

      /* End of Addition */

 

      List<CustomerInfo> customerList=null;

     //populate customer list

   if(reset!=null && reset.equals("true"))

   {

        customerList=helper.getCustomers(userId);

        Collections.sort(customerList);

        switchBackhaulForm.setCustomerNames(customerList);

        logger.info(" got customers  " + customerList.size());

        switchBackhaulForm.setClientServiceList(null);

        //make a call to helper to get the Filter inputs

        helper.getFilterInputs(userId,switchBackhaulForm);

        forward="customerSuccess";

   }

 

 

     logger.info("Clicked on Action :" + actionName);

 

     ArrayList<ServiceInfo> filterServices=null;

 

     if(actionName==null)

     {

     logger.info("cleaning session ");

         cleanSession(request);

     }

     while(actionName!=null){

         if(actionName.equals("Fetch")){

                 logger.info("Fetch Circuits Action :" + IConstant.ENTERED);

                 /* Added Change By Sukanta dey for SVC Layer*/

                 helper.getCircuits(switchBackhaulForm,userId);

                 /* Change End */

                 List ipProfiles=helper.getAllIpProfiles(userId);

                 logger.info("Fetch Circuits Action :" + IConstant.EXITED);

 

             break;

          }

 

 

                 if(actionName.equals("Get Services")){

                  String forceEnabledCheckbox=request.getParameter("forceEnabledCheckbox");

                  System.out.println("forceEnabledCheckbox : "+forceEnabledCheckbox);

                  if(forceEnabledCheckbox!=null){

                     forceEnabled=Boolean.parseBoolean(forceEnabledCheckbox);

                     session.setAttribute("forceEnable",forceEnabled,PortletSession.APPLICATION_SCOPE);

                  }

                  logger.info("Get Services Action :" + IConstant.ENTERED);

                 boolean showDisconnectCheckbox=switchBackhaulForm.getShowDisconnectCheckbox();

                 String [] selectedFrom=request.getParameterValues("selectedFromCircuit");

                 System.out.println("selectedFrom : ");

                 for(int i=0;i<selectedFrom.length;i++){

                 System.out.print(selectedFrom[i]+",");

                 }

                 if(showDisconnectCheckbox){

                  if(selectedFrom != null && selectedFrom.length > 1){

                     logger.info("***Checkbox value is True***" + selectedFrom[0]);

                     switchBackhaulForm.setSelectedFromCircuit(selectedFrom[0]);

                 }

                 }

                 else{

                 if(selectedFrom != null && selectedFrom.length > 1){

                     logger.info("***Checkbox value is False***" + selectedFrom[1]);

                     switchBackhaulForm.setSelectedFromCircuit(selectedFrom[1]);

                 }

                 }

                 selectedFrom=null;

                 /* Added for Display all checkbox change */

                 //get the status of the displayAll checkbox

                 boolean displayAllCheckbox=switchBackhaulForm.isDisplayAllCheckbox();

                 //collect the values of checkboxes

                 String [] selectedTo=request.getParameterValues("selectedToCircuit");

                 System.out.println("selectedTo : ");

                 for(int i=0;i<selectedTo.length;i++){

                 System.out.print(selectedTo[i]+",");

                 }                   

                 //chk the vallue of checkbox

                 if(displayAllCheckbox){

                 if(null != selectedTo && selectedTo.length > 1){

                     logger.info("*** Display All Checkbox value is True ***" + selectedTo[0]);

                     //if checkbx is checked get the circuit from total circuits

                     switchBackhaulForm.setSelectedToCircuit(selectedTo[0]);

                 }

                 }

                 else{

                        if(null != selectedTo && selectedTo.length > 1){

                     logger.info("*** Display All Checkbox value is False ***" + selectedTo[1]);

                     //if checkbx is not checked get the circuit from matching circuits

                     switchBackhaulForm.setSelectedToCircuit(selectedTo[1]);

                 }

                 }

                 //make the string array null

                 selectedTo=null;

 

                 /* End of Addition */

             String circuitId=switchBackhaulForm.getSelectedFromCircuit();

             logger.info(

...

[Message clipped]