title: Play2 : compilation error with implicit value for parameter flash
body: <p>I begin in Play 2 and Scala, and I create a very simple login form. All works perfectly until I use flash to store the login result. All I obtained is  the error :</p>
  
  <p><code>/home/denis/dev/workspace/atabank/app/views/login.scala.html:5: could not find implicit value for parameter flash: play.api.mvc.Flash</code></p>
  
  <p>According the Play documentation, I put in my controllers <code>implicit request =&gt; ...</code>, I use <code>Ok(...).flashing("error" -&gt; "wrong password")</code>, but the error still here...</p>
  
  <p>Here my code :</p>
  
  <p>Login controller :</p>
  
  <pre><code>package controllers
  
  import play.api.data.Form
  import play.api.data.Forms.{ mapping, nonEmptyText }
  import play.api.mvc.{ Action, Controller, Flash }
  
  object Login extends Controller {
  
  def login = Action { implicit request =&gt;
      Ok(views.html.login())
  }
  
  def authenticate() = Action { implicit request =&gt;
      {
      val form = loginForm.bindFromRequest()
  
      form.fold(
          hasErrors = {
          form =&gt;
              Redirect(routes.Login.authenticate()).flashing("error" -&gt; "Connection error")
          },
          success = {
          userInfo =&gt;
              if ("123456".equals(userInfo.password))
                  Redirect(routes.Home.show(userInfo.login)).flashing("success" -&gt; "Successfully connected")
              else
                  Redirect(routes.Login.login()).flashing("error" -&gt; "Wrong password")
  
          })
      }
  }
  
  val loginForm: Form[LoginInfo] = Form {
      mapping(
          "login" -&gt; nonEmptyText,
          "password" -&gt; nonEmptyText)(LoginInfo.apply)(LoginInfo.unapply)
      }
  
  }
  
  case class LoginInfo(login: String, password: String)
  </code></pre>
  
  <p>login.scala.html :</p>
  
  <pre><code>@()(implicit flash: Flash, lang: Lang)
  @import helper._
  @import controllers.Login._
  
  @main("Login") {
  
      &lt;div class="container"&gt;
  
          @helper.form(action = routes.Login.authenticate(), 'role -&gt; "form", 'class -&gt; "form-signin") {
              &lt;h2 class="form-signin-heading"&gt;Please sign in&lt;/h2&gt;
              &lt;input type="email" name="login" class="form-control" placeholder="Email address" required autofocus&gt;
              &lt;input type="password" name="password" class="form-control" placeholder="Password" required&gt;
              &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
          }    
      &lt;/div&gt;
  
  }
  </code></pre>
  
  <p>main.scala.html :</p>
  
  <pre><code>@(title: String)(content: Html)(implicit flash: Flash, lang: Lang)
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;@title&lt;/title&gt;
          &lt;!-- CSS, JS --&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="container"&gt;
              @if(flash.get("success").isDefined) {
                  &lt;div class="alert alert-success"&gt;
                      @flash.get("success")
                  &lt;/div&gt;
              }
              @if(flash.get("error").isDefined){
                  &lt;div class="alert alert-error"&gt;
                      @flash.get("error")
                  &lt;/div&gt;
              }
              @content
          &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>home controller :</p>
  
  <pre><code>package controllers
  
  import play.api._
  import play.api.mvc.{ Action, Controller }
  import play.api.mvc.Flash
  
  object Home extends Controller {
  
      def show(username: String) = Action { implicit request =&gt;
          Ok(views.html.home(username))
      }
  
  }
  </code></pre>
  
  <p>home.scala.html :</p>
  
  <pre><code>@(username: String)(implicit flash: Flash, lang: Lang)
  
  @main("Home page") {
      &lt;h1&gt;Welcome Mister @username&lt;/h1&gt;
  }
  </code></pre>
  
  <p>Thanks for your help.</p>