• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session tracking------urgent

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
in session.putValue() can i put an array of strings.
if yes ,then how do i typecast in session.getValue().
String[]names;
HttpSession session;
session.putValue("xyz", names) - is it valid ?
if yes then how do i retrieve names

names = (?)session.getValue("xyz");
if no then any other way like vector etc. to pass a related data
in session tracking.
thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

>session.putValue("xyz", names) - is it valid ?
Sure, why wouldn't it be, arrays are all Objects, you can cast
Object obj = names ;
>if yes then how do i retrieve names
Use the same notation you would use to declare a String array:
names = (String[])session.getValue("xyz");
Bill
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi William,
thank you.initially i did the same and got an error ,so,tried it with vector and it worked.may be in the first case i made a mistake while using the values in the doGet()method.
Strings are real headache except when they are used in println().
regards,
vnk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic