On Tue, Apr 28, 2009 at 10:57 PM, pravin karne <pravinka...@gmail.com>wrote:
> what is the is+ method > sessionObj.is+ ("foo" -> 1) sessionObj.is gets the contained object from the SessionVar. In this case, that object is a HashMap. The + method is on HashMap: http://www.scala-lang.org/docu/files/api/scala/collection/mutable/HashMap.html > > how it differ from sessionObj.is("foo" -> 1) > HashMap does not have an apply(p: Pair[??,??]) method, so this would not compile. > > On Tue, Apr 28, 2009 at 8:33 PM, David Pollak < > feeder.of.the.be...@gmail.com> wrote: > >> >> >> 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 >> >> >> >> > > > > -- 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 -~----------~----~----~----~------~----~------~--~---