aspose file tools*
The moose likes JSP and the fly likes Handling Vector in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Handling Vector in JSP" Watch "Handling Vector in JSP" New topic
Author

Handling Vector in JSP

Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
Hi all,
Could someone show me how to pass a Vector element from one jsp to another via HREF?
I need to pass a cetrtain element upon selection.
Here's what I have:

and what I need is to be able to pick an element using the row integer variable, and pass it to next JSP.

Appreciate greatly, as always do.
Shawn Bayern
Author
Ranch Hand

Joined: May 06, 2002
Posts: 160
It's probably easiest to use a session-scoped variable. With JSTL:
<c:set var="foo" scope="session" value="${myVector} />
Then, in the receiving page, you may simply refer to ${myVector} or, more explicitly, ${sessionScope.myVector}.


Shawn Bayern<br />"JSTL in Action" <a href="http://www.jstlbook.com" target="_blank" rel="nofollow">http://www.jstlbook.com</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Med, you didn't say how you were making the transition from one JSP page to the other. Whether you are doing a redirect, forward or include has a great impact on the asnwer to your question.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
I'm just using the HREF tag to go to next JSP and since the App is session based the Vector goes with it. However, what I'd like to be able to do is to make the transition to next JSP with a certain Vector element only, upon clicking on a link.
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Well, since the taget page is a new request your choices are:
1) Stick it in the session
2) Stick it on the query string
3) Stick it into a hidden form field
What is the type of the element you are trying to pass across?
hth,
bear
[ August 22, 2002: Message edited by: Bear Bibeault ]
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
FOLKS, PLEASE;
read the posting before responding.
I CAN PASS THE VECTOR NO PROBLEM.
I am passing a Result Set within the Vector and am upwrapping the Vector in first JSP. Is there any way to pass only say element no 3 in the Vector upon selection? The reasn; so I can build another query once I know what was selected.
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Yes, we understand that. So I repeat: what is the nature of the data you are tyring to pass across? Is it a String, a number, a large complex class?
The fact that it came out of a vector is immaterial. What is the data you need to pass?
bear
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
Vector elements are ArrayLists.
[ August 23, 2002: Message edited by: Med Shabe ]
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
Originally posted by Med Shabe:
Vector elements are ArrayLists.
[ August 23, 2002: Message edited by: Med Shabe ]

What types of values are in the ArrayLists? It would be helpful to give us some sort of context as to what you are doing. Are the values in the array list the parameters to a query?


James Carman, President<br />Carman Consulting, Inc.
Med Shabe
Ranch Hand

Joined: May 08, 2001
Posts: 84
I think all these questions led me to a solution. Hopefully you won't hear from me about this issue.
Thanks much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling Vector in JSP
 
Similar Threads
K&B generics doubt
Display data using Structs Tag
JSTL iteration of a list with numbering
JTable ClassCastException...
Checkbox editor for JTable column