By default a new instance is used for the snippet every time the view references it. Extend StatefulSnippet (which brings in DispatchSnippet, so you will have to specify a dispatch function), and it will get reused.
------------------------------------- pravin<[email protected]> wrote: hi... i have one snippet class called Search like this ---- class Search{ private var count=0; // I have one method name :"fun1".In this method i am changing the value of count(class lavel variable) def fun1(xhtml:NodeSeq):NodeSeq={ count=10; bind ("entry",xhtml, "SerchStringLable" -> "WebApp", "SerchStringValue" -> SHtml.text(valueString,valueString =_, "submit" -> SHtml.submit("Explore",processEntry _)) } // i have second method Name:"fun2" .In this method i am accessing same variable(count). def fun2(xhtml:NodeSeq):NodeSeq={ println("Count :"+count) // this prints 0 instaed of 10 ...why bind("t", xhtml,"resultRows" -> buildRows) } } //fun1 is called before fun2 But in fun2 ,i found default value for "count" i.e 0 why i didnt get update value that i changed in fun1.... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
