S.redirectTo leads always to a blank screen

Posted by Jaime Ocampo on Stack Overflow See other posts from Stack Overflow or by Jaime Ocampo
Published on 2011-01-11T08:50:15Z Indexed on 2011/01/11 8:53 UTC
Read the original article Hit count: 225

Filed under:
|

I am now playing a little bit with lift (2.8.0), and all the features in LiftRules work as intended. But I haven't been able to use S.redirectTo at all. I always ends with a blank screen, no matter what. No error messages at all!

As an example, I have the following form:

...
  <lift:logIn.logInForm form="post">
    <p><login:name /></p>
    <p><login:password /></p>
    <p><login:submit /></p>
  </lift:logIn.logInForm>
  ...

And the code is:

object LogIn extends helper.LogHelper {

    ...
    def logInForm(in: NodeSeq): NodeSeq = {
      var name = ""
      var password = ""

          def login() = {
          logger.info("name: " + name)
          logger.info("password: " + password)
          if (name == "test1") S.redirectTo("/example")
          if (name == "test2") S.redirectTo("/example.html")
          if (name == "test3") S.redirectTo("example.html")
          S.redirectTo("/")
          }

    bind("login", in,
      "name" ->     SHtml.text(name, name = _),
      "password" -> SHtml.password(password, password = _),
      "submit" ->   SHtml.submit("Login", login))
    }
  }

The method 'login' is invoked, I can check that in the log information. But as I said, no matter which name I enter, I always end with a blank screen, although 'examples.html' is available when being accessed directly in the browser. How should I invoke S.redirectoTo in order to navigate to 'examples.html'? Also, why don't I receive an error message (I am logging at a debug level)?

I think all the configuration in Boot is correct, since all LitRules examples (statelessRewrite, dispatch, viewDispatch, snippets) work fine.

© Stack Overflow or respective owner

Related posts about scala

Related posts about lift