On Sun, Apr 12, 2009 at 7:14 AM, marius d. <marius.dan...@gmail.com> wrote:

>
> The StatefulSnippet is not a snippet instance that is always used in
> the context of your session.
>

Yikes! in that case, I wrote a whole application based on false assumption.
It says in the lift book
a StatefulSnippet is "ideal for small, conversational state, such as a form
that spans multiple pages"
If it spans multiple pages, doesn't this kind of imply the same instance in
the session?

Anyway thanks for this info. Any reason why a StatefulSnippet always has a
dispatch function and
a Stateless one, by default, has not?


to avoid RequestVar-s but keep state for current rendering pipeline in
> the snippet.
> 2. You can indicate that you want to reuse the same instance across
> multiple pages using link or redirectTo functions from the
> StatefulSnippet
>
> So depending what you want to doyou can use the statefull or stateless
> nature of snippets. For stateless snippets you can just declare the
> class and the method and just use it. Such as:
>
> class Foo {
>
>  def bar(xml: NodeSeq) :NodeSeq = ...
> }
>
> .. and in your markup
>
> <lift:Foo.bar/>
>
> you can also say
>
> class Foo  extends DispatchSniuppet {
>
>   def dispatch = ...
> }
>
> which is also a stateless snippet.
>
> Br's,
> Marius
>
> On Apr 11, 7:21 am, Oliver Lambert <olambo...@gmail.com> wrote:
> > I have a stateful snippet that doesn't always appear to work with the
> back
> > button.
> > Sometimes, when the back button is used, a new stateful snippet instance
> > appears to be created. Has this happened to anyone else?
> >
> > Anyway, I've converted what I had to use a SessionVar to store the state.
> > Should I replace the stateful snippet with a stateless one - does a
> stateful
> > snippet that isn't storing any state have any extra overhead over a
> > stateless one?
> >
> > If I do use a stateless snipet can I still have a dispatch method?
> >
> > cheers
> > Oliver
> >
>

--~--~---------~--~----~------------~-------~--~----~
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