[error][not found: type Session] when trying to get access session value in scala.html

I am using Play 2.8, have switched from Play 2.6 recently.

I and geting an error when in Play 2.8 when i try to access session or flash in my template (scala.html).
I have a basic action written in controller.


public Result exp() {
        Http.Session session = new Http.Session().adding("error","This is " +
        return ok(views.html.exp.render()).withSession(session);

With a basic scala.html

@()(implicit session: Session)
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Experiment Page</title>
@if(session.get("error")contains("This is error.")){
<p>this is session.</p>
<p>Does Not Contain Flash.</p>


when I compile, this error comes:

[info] Compiling 13 Scala sources and 54 Java sources to F:\IdeaBlock\highcourt_project\highcourt\target\scala-2.13\classes ...
[error] F:\IdeaBlock\highcourt_project\highcourt\app\views\exp.scala.html:1:1: not found: type Session
[error] @()(implicit session: Session)
[error] ^
[error] F:\IdeaBlock\highcourt_project\highcourt\app\views\exp.scala.html:1:23: not found: type Session
[error] @()(implicit session: Session)
[error]                       ^
[error] F:\IdeaBlock\highcourt_project\highcourt\app\views\exp.scala.html:17:8: not found: type Session
[error] </html>
[error]        ^
[error] three errors found.

I have to pass the Session object explicitly in views.html.exp.render() to make it work.
But this isnt the correct way as it makes my scala.html and controller tightly coupled. Also passing Flash object explicitly defeats the purpose when i also have to pass it in response as: Results.ok(“Some String/ HTML”).withFlash(flash);