aspose file tools*
The moose likes Servlets and the fly likes context.setAttribute (object) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "context.setAttribute (object)" Watch "context.setAttribute (object)" New topic
Author

context.setAttribute (object)

Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Hi all,
I got an question regarding context.setAttribute (object) , for instance :
here i made hashmap then put it as an attribute in the context, my question is , if i changed the "key1" after setting the hashMap in the context , is it will be reflected directly or i need to write context.setAttribute ("hashMap", temp) ; after line 4 ?


Thanks,
Sherif
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
You'll find the answer by printing out the contents of the hash map after the 4th line!


OCJP 6 (93%)
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12781
    
    5
The reference to the HashMap now exists in two places - local variable and context, but it is still the same HashMap.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: context.setAttribute (object)