5 Replies Latest reply on Aug 10, 2012 12:14 PM by DR1301

    Reading property values form a component sitting inside another page not in the the current...

    DR1301

      I am new at CQ5 - Is ist possible to get property values from a component which is not in the current page ?

      I want to read values from a component which is inside another jsp page

       

      Can anyone helps me in this case ?

        • 2. Re: Reading property values form a component sitting inside another page not in the the current...
          Justin Klei

          Can you explain a little more about the use case around what you're trying to do?  These properties might be better suited on the design dialog instead, depending on what they are.  Also, it sounds like you're potentially going down the path of writing some bad code which won't be very flexible and will be difficult to maintain.

          • 3. Re: Reading property values form a component sitting inside another page not in the the current...
            DR1301 Level 1

            Look, i've got a own cq5 component in a jsp page.

            Inside this component are some textboxes where the user can input things like MV=Product.

            Now i read this input values via javscript like this..

             

            var arrayOfProperties = new Array(8);

                      arrayOfProperties[0]='<%=properties.get("institute1", String.class)%>'; //component value

                      arrayOfProperties[1]='<%=properties.get("institute2", String.class)%>'; //component value

                      arrayOfProperties[2]='<%=properties.get("institute3", String.class)%>'; //component value

                      arrayOfProperties[3]='<%=properties.get("institute4", String.class)%>'; //component value

                      arrayOfProperties[4]='<%=properties.get("institute5", String.class)%>'; //component value

             

                      arrayOfProperties[5]='<%=properties.get("institute6", String.class)%>'; //component value

                      arrayOfProperties[6]='<%=properties.get("institute7", String.class)%>'; //component value

                      arrayOfProperties[7]='<%=properties.get("institute8", String.class)%>'; //component value

                      arrayOfProperties[8]='<%=properties.get("institute9", String.class)%>'; //component value

             

             

             

                     for (var p = 1; p < 10;p++)

                     {

                              if ( arrayOfProperties[p-1] != null)

                         {

             

                              var propertyValue= arrayOfProperties[p-1];

             

                              var arrayOf = new Array(2);

                              arrayOf = propertyValue.split("=");

             

                                /*

                                     arrayOf[1]  is Product

                                     arrayOf[0]  is  MV

                                */

             

             

                              if (arrayOf[1] != null)

                              {

                                       propertyValue = arrayOf[1];

                              }

             

             

                             document.getElementById('checkboxInstitute' + p.toString()).innerHTML =  propertyValue  ;

             

            now the user can check some values and send this information via email (now i redirect him to another page)

            in this page i want get the same information from the last page (the component values i 've read with javascript) now i want to get the same information from the component on the next jsp page just reading with java from the page i come from

            • 4. Re: Reading property values form a component sitting inside another page not in the the current...
              Justin Klei Level 1

              Okay, this information helps.  Sounds to me like you just need to pass this information along with the request, and then retrieve those request parameters in the next JSP?

              • 5. Re: Reading property values form a component sitting inside another page not in the the current...
                DR1301 Level 1

                Yes that is right . Is there a way to get the information from the component values in the next jsp via java  ?  Not via javascript ! Can u help me ?