[Lift] Re: StatefulSnippet Beginner

2009-04-27 Thread Derek Chen-Becker
StatefulSnippet example is in now. On Sat, Apr 18, 2009 at 8:44 PM, Derek Chen-Becker wrote: > I'll add in an example for StatefulSnippet. We have one already in > PocketChange, so I just need to copy the code listing in. You should be able > to mix the two as you see fit. > > Derek > > > On Sat,

[Lift] Re: StatefulSnippet Beginner

2009-04-19 Thread Derek Chen-Becker
Still have to do StatefulSnippet, but the example of passing info in a RequestVar (listing 3.24) is updated to show a redirectTo example as well. Derek On Sat, Apr 18, 2009 at 8:44 PM, Derek Chen-Becker wrote: > I'll add in an example for StatefulSnippet. We have one already in > PocketChange, s

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread Derek Chen-Becker
I'll add in an example for StatefulSnippet. We have one already in PocketChange, so I just need to copy the code listing in. You should be able to mix the two as you see fit. Derek On Sat, Apr 18, 2009 at 6:58 PM, bradford wrote: > > Thanks, Derek. I read the updated PDF version of the book on

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread bradford
Thanks, Derek. I read the updated PDF version of the book on "The Lift Book" group. I think it looks good. I think an example with redirectTo may be better than link. Also, personally, I'm not sure if I understand StatefulSnippet now. It doesn't seem like you can mix the two. I updated my co

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread Derek Chen-Becker
OK, I just added some more explanation on passing state between snippets to section 3.15 in the book. I just uploaded a new PDF. When you have a chance could you look at it and let me know if that makes sense? Also, I wasn't sure if this should be a separate section ("Passing Data Between Snippets"

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread Derek Chen-Becker
A RequestVar is only "live" for the duration of the request, and a redirectTo ends up sending a 307 temp redirect to the browser, which results in a new request. S.redirectTo does have an overload that allows you to pass a function that will be called when the redirected request is handled. Some sk

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread bradford
Thanks, Tim. I worked around that issue. I would still like to know whether or not it's possible have RequestVars carry over to the redirected page. I'm attaching a modified demo. If I use just a var, it will maintain the state. If I use RequestVar, it won't transfer the state. Well.. I coul

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread Timothy Perrett
Its talking about Hibernate session, not lift session. Perhaps you have a detached model or something your trying to work on? Cheers, Tim On 18/04/2009 19:08, "bradford" wrote: > no session or session was > closed > > I'll look into this some more. --~--~-~--~~~--

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread bradford
Thanks, Sergey. When I removed the reuqestVar, changing these two lines object productVar extends RequestVar(new Product()) def selectedProduct = productVar.is to var selectedProduct = new Product() It worked. Now I'm having a Hibernate problem. Message: org.hibernate.LazyInitializationExce

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread Sergey Andreev
Could you attach a sample code which doesn't work? On Sat, Apr 18, 2009 at 8:41 PM, bradford wrote: > > I have "changed class Products {" to read "class Products extends > StatefulSnippet {" > > Instead of S.redirectTo, I now have this.redirectTo and it still > doesn't seem to be saving the sta

[Lift] Re: StatefulSnippet Beginner

2009-04-18 Thread bradford
I have "changed class Products {" to read "class Products extends StatefulSnippet {" Instead of S.redirectTo, I now have this.redirectTo and it still doesn't seem to be saving the state. On Apr 17, 10:55 pm, Derek Chen-Becker wrote: > OK, first, your snippet class needs to extend StatefulSnip

[Lift] Re: StatefulSnippet Beginner

2009-04-17 Thread Derek Chen-Becker
OK, first, your snippet class needs to extend StatefulSnippet. Then you need to define the dispatch partial function to tell it which snippet goes to which function, and then you need to use StatefulSnippet.link and StatefulSnippet.redirectTo instead of SHtml.link and S.redirectTo, respectievly. D

[Lift] Re: StatefulSnippet Beginner

2009-04-17 Thread bradford
I guess it would help to mention that is on index.html and is on select.html. On Apr 17, 9:45 pm, bradford wrote: > I'm trying to play around with the StatefulSnippets and can't get it > to hold state.  This is what I have for a test: > > class Products { >   object productVar extends RequestV