Bookmark Topic Watch Topic
  • New Topic

how to keep data from one request to another?

 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
i got several DTOs from a Servlet through the request object.

Then, i display data from those DTOs on the page, specifically on a link

And, as you see, i link one field of the DTO to another JSP, and inside this other JSP i still want to get data from the DTOs present in that (the current page) page. In other words, i wanna to keep the DTOs from this request and send to another.
I could set the request attributes again or set HttpSession data, but if i don't wanna do that, is ther a more efficient way???
Thanks,
ltcmelo
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65518
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
There is no way to cause a request attribute to survive across a request/response boundary.
If this data truly must survive the transition, what's your beef with the session?
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
No beef,
is just thought about a more automated way.
So, if i want to keep the data from this JSP (that initially came from my ServletAction - i'm using struts) to a forwarded JSP, i have to put data on HttpSession. It's the only way, right!?
 
Brahim Bakayoko
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Leandro Melo:
No beef,
is just thought about a more automated way.
So, if i want to keep the data from this JSP (that initially came from my ServletAction - i'm using struts) to a forwarded JSP, i have to put data on HttpSession. It's the only way, right!?

Requests attributes and parameters survive request dispatching only.
Struts dispatches requests by default. So, you can access the attributes and parameters in the later jsp.
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
I made another "reply" (actually, with a couple more doubts) to this topic on Struts and Other Frameworks forum.
If you could take a look there....
http://www.coderanch.com/forums/f-58/Struts
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65518
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
So, you can access the attributes and parameters in the later jsp.

That is not the situation described. The request attributes set during the creation of one JSP will go out of scope when that page is delivered to the client. They will not be available in the page displayed as a result of clicking the link on that first page.
Since this is also being discussed in the Struts forum, this topic will be closed.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!