aspose file tools*
The moose likes Servlets and the fly likes Help please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help please!" Watch "Help please!" New topic
Author

Help please!

Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
Hi all,
I have a problem.
The servlet is sending an array of objects of a class BB.
How do I access that this array in my JSP.
Thanks
Katie McCann
Ranch Hand

Joined: Jul 24, 2000
Posts: 45
You can store the array in either the session object or in the request object- put code something like this in the servlet:
To store in the session:
HttpSession sess= request.getSession();
sess.putValue("myarray", BBarray);
Then to access it from the JSP:
BB [] arr= (BB[])session.getValue("myarray");
To store in the request:
request.setAttribute("myarray", BBarray);
To access it in the JSP:
BB [] arr= (BB[])request.getAttribute("myarray");
Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
Thanks Katie McCann.
But the document says that the getAttribute returns the object bound with the specified name . Does that mean only one object or whatever we set using setAttribute. (ie it can be a single object or array of object).
Thanks
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It's important to understand that in Java, an array is an Object, just like the other aggregations (Hashtable, vector, List, Map, etc. etc.)


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help please!
 
Similar Threads
Widening Reference Conversation
Sorting an Array
how many objects will be created.
WA #1.....word association
Multi Dimension Array Storing