David,

Just a quick followup, this code actually does what I want, although
I still have yet to reset the loginReferer SessionVar back to the
default.

override def homePage = {
      var ret = loginReferer.is
      loginReferer.substring(loginReferer.toString.lastIndexOf('/') +
1) match {
                case "group" => ret = Company.createPathString
                case _ => ret = loginReferer.is
      }
      ret
  }

On May 19, 9:08 am, glenn <[email protected]> wrote:
> David,
>
> I'm sorry too, because I was already using  loginReferer.is. The
> problem
> is the loginReferer.remove  line has to be removed for the redirect
> to work. Don't know why. You would think the ret var
> would stay put, but it doesn't.
>
> Glenn...
>
> On May 18, 3:57 pm, David Pollak <[email protected]>
> wrote:
>
> > Glenn,
>
> > Sorry... my mistake... the following code works:
>
> >   object loginReferer extends SessionVar("/")
>
> >   override def homePage = {
> >     var ret = loginReferer.*is*
> >     loginReferer.remove()
> >     ret
> >   }
>
> >   override def login = {
> >     for (r <- S.referer if loginReferer.is == "/") loginReferer.set(r)
> >     super.login
> >   }
>
> > Note the "is" which extracts the contents from the SessionVar before it's
> > reset.
>
> > On Sun, May 17, 2009 at 10:30 AM, glenn <[email protected]> wrote:
>
> > > David,
>
> > > I was a little puzzled by the line, in the override of def homePage,
> > > of loginReferer.remove(). This actually resets the homePage to "/".
> > > Removing the line has the intended result. But, then I need a way
> > > to reset the loginReferer session variable.
>
> > Yeah... the reset happened before the old value was removed from the
> > SessionVar.  The above code fixes the problem.
>
> > > Better still, it would be nice to be able to create additional
> > > stateful
> > > parameter maps, something like Seam's conversation state, which
> > > would make creation of wizards a breeze.
>
> > There's some of that we StatefulSnippets... seehttp://demo.liftweb.net/arc
>
> > I'm hoping that we'll get full wizard support in Lift for 1.1 
> > (seehttps://www.lostlake.org/wizard.wmvexceptusing a DSL like SiteMap rather
> > than XML).
>
> > > This brings up another point. The only way I trust to trace the code
> > > to determine what's going on is the old-fashioned way, of putting in
> > > a bunch of println statements in my code. With lift's flow back-and-
> > > forth
> > > between templates, which are really client-side, and snippets, which
> > > are on the server, normal java debugging tools just doesn't work.
>
> > That's strange.  There's nothing rendered to the client until all the
> > template stuff is fully rendered (the templates are processed by the server
> > and the snippets are invoked as the <lift:xxx/> tags are encountered during
> > the first re-write phase of template process.)
>
> > People have had success setting breakpoints in Eclipse, NetBeans and
> > IntelliJ in Lift apps.  I use println personally.
>
> > Thanks,
>
> > David
>
> > > This makes developing a slow process and can even offset the gains
> > > lift brings to coding efficiency.
>
> > > What do you, and other's use for debugging that might help.
>
> > > Thanks in advance for your assistance.
>
> > > Glenn...
>
> > > On May 15, 3:35 pm, David Pollak <[email protected]>
> > > wrote:
> > > > In your User object, do the following:
>
> > > > object loginReferer extends SessionVar("/")
>
> > > > override def homePage = {
> > > >   var ret = loginReferer
> > > >   loginReferer.remove()
> > > >   ret
>
> > > > }
>
> > > > override def login = {
> > > >   for (r <- S.referer if loginReferer.is == "/") loginReferer.set(r)
> > > >   super.login
>
> > > > }
>
> > > > So, we're setting up a session variable the keeps track of the referer 
> > > > to
> > > > the login page.
>
> > > > We define the homePage method to return this page, but reset after use.
>
> > > > And we override the login method to record the referer.
>
> > > > On Fri, May 15, 2009 at 3:11 PM, glenn <[email protected]> wrote:
>
> > > > > I'm using ProtoUser. But even so, I thought that I might have to
> > > > > create a
> > > > > bunch of separate login pages, each using the loginXhtml form so that
> > > > > action={S.uri} would generate the links to match with the cases. In
> > > > > that
> > > > > way I could do the redirection. But that seems convoluted, to me.
>
> > > > > This goes back to using EarlyAccess on a menu item, redirecting to the
> > > > > appropriate
> > > > > login page, and then once the user logs in, he is immediately taken to
> > > > > a new page
> > > > > rather than back to "/index". Really, what I'm trying to do is create
> > > > > a wizard widget
> > > > > or sorts, to perform a sequence of tasks with a finish button on the
> > > > > last page.
>
> > > > > Glenn...
>
> > > > > On May 15, 2:43 pm, David Pollak <[email protected]>
> > > > > wrote:
> > > > > > On your login page, you can capture the referer and then redirect to
> > > the
> > > > > > refering page on successful login.
>
> > > > > > Are you using ProtoUser or are you rolling your own login page?
>
> > > > > > On Fri, May 15, 2009 at 1:27 PM, glenn <[email protected]> wrote:
>
> > > > > > > If I wanted to redirect the user to a different page, depending on
> > > > > > > what page they were on when they initiated a login,
> > > > > > > does anyone know of a good solution?
>
> > > > > > > I'm thinking I need to use a DispatchLocSnippets and define
> > > different
> > > > > > > dispatch case functions. But I'm not clear how best to go about 
> > > > > > > it?
> > > > > > > Would I need different login pages for each case, or is there a
> > > > > > > cleaner way in which I can use a single login page for job?
>
> > > > > > > Glenn...
>
> > > > > > --
> > > > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > > > Follow me:http://twitter.com/dpp
> > > > > > Git some:http://github.com/dpp
>
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > Follow me:http://twitter.com/dpp
> > > > Git some:http://github.com/dpp
>
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to