This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Array from one JSP to other (HOW)?

 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a JSP file that retrive items from an XML and present them in Table. I implement two submit buttons that according the button, JSP goes to other JSP page and sort them. My question is how i can now, to bring back the sorted elements to first JSP and present them on Table. (Sorted items on 2nd JSP stored in Array).
thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64183
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the controller for the first JSP, cache the data in the session. That way it will be available to the second JSP and its controller.
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean to cache session on 2nd JSP so i can access them on JSP?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64183
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, caching in the session is one of the most common ways to extend the scope of data across multiple requests.
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i did


Now how i will print out the elements in 1st JSP Table?
I know that i will use but how exactly to get all array's elements?
 
Paul Clapham
Sheriff
Pie
Posts: 20182
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL c:forEach tag is the most straightforward way to do that.
 
Pan Niko
Ranch Hand
Posts: 86
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How i will convert the Object to double?
Can i have a generall structure please about how to get the elements and how to print them out?
thabk you
 
Paul Clapham
Sheriff
Pie
Posts: 20182
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't convert the Object to double. You let JSTL take care of all of that.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic