• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session tracking------urgent

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic