0

I tried using request attributes to share data between two jsps of two components but its not working as the second jsp is getting the new request. I've also gone through this question but its not fitting my scenario. How to share data or strings between two component jsps which are set as sling:resourceType to two different pages? Here is more information about the scenario: There will be a link on the first component which when clicked will take to the second page having another component as a resourceType.

Thank you.

Community
  • 1
  • 1
user3487063
  • 3,672
  • 1
  • 17
  • 24
  • Welcome to SO! It would be helpful to let us know what if anything you have tried to do to resolve this. – Daniel E. Apr 23 '14 at 23:09
  • Thank you Daniel. Actually as a work around right now I'm writing the data to a file and reading it from another component's jsp. But checking if there is a way in CQ/Sling APIs to pass data between two JSPs/components. request.setAttribute/getAttribute does not work in this case as both pages are getting new requests. – user3487063 Apr 24 '14 at 01:40

1 Answers1

0

As you already noted, these are two different requests so attributes set on the first one would not be available on the second request, which originates on clicking the link.

I assume that the data you want to pass ( XML String ) can be pretty huge in size so you do not want to use request parameters. In that case, you could save the data in some temporary location ( in the repository or the disk ) and then pass the path to that location as a request parameter ( by encoding it in the link itself ) to the other component.

Agraj
  • 466
  • 5
  • 19