Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Putting Multi Dimentional Array into a session in JSP  RSS feed

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,

can anyone help me on this topic?
Is it possible to put a multi dimentional array of String type into a session as we put a single dimentional array?

for example,
we put name[i] in session as

for(int i=0;i<strlen;++i)
{
name[i]=request.getParameter("somevalue");
}

sessionobj.putValue("SessionName" , name)

in the same way, can we put a multi dimentional array, say name[][] into session? I tried to do it in the same way as the single dimentional array.
but to fail. can anyone help me on the above topic? also can you please help me with the syntax?

thanks in advance....
 
Nitin Menon
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, the webserver used was jboss.
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Nitin Ram:
...
but to fail.



Doesn't tell us much.
What went wrong?

The short answer to your question is, yes, arrays can be stored in session.
Arrays are objects and session attributes are references to objects.

Also, there is no such thing as a true multi dimensional array in Java.
x[][] is nothing more than an array of arrays.
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure you can stick a multi dimension array. Any object will do.

Please post your error here so that we can help you better
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!