Win a copy of Python Continuous Integration and Delivery this week in the Python 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:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

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
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!