3 Replies Latest reply on Mar 18, 2013 11:57 PM by creative83

    Produclist rootPath not added


      I tried to use the productlist component created by geometrixx. I am able to drag an drop and then it works file. But same if I tried to add using below code:


      <cq:include path="productlist_123" resourceType="sitesmart/components/productlist"/>


      Then I have below issues:


      1) It shows Null pointer error on the page. But when I double click that error, it opnes the productlist dialogbox.

      2) Now if I try to add any record by click on insert and then type values and click on save, then it doesnt save anything. Values are erased.

      3)Now if I clsoe the dialog(without any value stored) not it is not showing Null pointer error but shows just the header of column, as no values are stored for them.



      My Observation and workaround:

      1) I compared the one I creaed using code and one using drag drop, the difference was, when I drag and drop, it addes one more property to the productlist node which is "rootPath" where as this was not present in the one I include using JSP. I added it manually and it started working.



      1)Please help me to resolve this error. How can I add the rootPath property?

      2) Can I also add Image component inside this productlist? Because each product has its own Picture and I wanted to have that in single place.

        • 1. Re: Produclist rootPath not added
          Sham HC Level 7

          Hi Ujjva,


              At productlist.jsp modify [1] to set the right value as per your need.


              [1] rootPath = currentNode.getPath();




          • 2. Re: Produclist rootPath not added
            creative83 Level 1



            ProductList is the component and if I hadcode the value of the rootPath then for each productList it will use the same location. I may have multiple instance of ProductList and in that case I need to keep the root path different.


            If i add the productList component in sidekick, and dragdrop then it automatically adds the rootPath like productlist_1 and for next one productlist_2 and so on. But when I add it usingcq:include in JSP it doesn't assigns it.


            I wanted to keep it dynamic and not the fixed. One way is to retirve the JCR noed and set the property.  is there any direct property like cq:include ?


            also you told to modify the productlist.jsp, this JSP feel is jsut to display the content, and not for storing. So if I change here it doesn't make any change.


            Can I also add the workflow for approving each product?

            • 3. Re: Produclist rootPath not added
              creative83 Level 1

              I am able to solve the above issue by below code:



                Session session = currentNode.getSession();
                 currentNode.getNode("productList_1").setProperty("sling:resourceType","mySite/components/ productlist");
                 currentNode.getNode("productList_1").setProperty("rootPath","/content/mySite/en/add-produ ct-page/jcr:content/productList_1");


              <cq:include path="productList_1" resourceType="mySite/components/productlist"/>