On Tue, Apr 28, 2009 at 5:30 AM, pravin <pravinka...@gmail.com> wrote:

>
> Hi guys,
> I want to add objects into session scope.
>
> i am using following code :
>
> object sessionObj extends SessionVar[HashMap[String, Int]](
>        new HashMap[String, Int]
>          {
>           override def default(key: String): Int = 0
>         }
> )
>
> So as per my understanding :-
>
>    1. Session object is of HashMap[String, Int] type.
>    2. I want to add no of string object into above map so i can
> access them during my session


to add an object to this session var:

sessionObj.is+ ("foo" -> 1)
sessionObj.is+ ("bar" -> 88)

if (sessionObj.is.contains("bar")) println("yes, it works")

The only caveat is that HashMap is not thread-safe and you might be
accessing this object from multiple threads at the same time.



>
>
>    correct me if i am wrong
>
>
>   So please let me know how can i add/remove  different String object
> from session scope with above code snippet
>
> Thanks in advance
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to