Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Putting Multi Dimentional Array into a session in JSP  RSS feed

 
Nitin Menon
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.
 
Ben Souther
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.
 
Deepak Bala
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!