[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

In JSP and Servlet, can I save a two dimensional array in the session variable?

So that I can pass that two dimensional array to the other page? If I can, should I implement serializable? If not, any alternate way exists?

Thanks.
0
ly_uwo
Asked:
ly_uwo
3 Solutions
 
objectsCommented:
arrays are objects so you can store them in your session:

in[][] myarray = new int[4][5];

session.setAttribute("name", myarray);
0
 
muthu_tigerfireCommented:
You can get back from the session by type casting it to your type..
like this

int[][] myarray = (int [][]) session.getAttribute("name");
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> If I can, should I implement serializable?

I don't think that's necessary.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now