There is a convenient library called play-bootstrap, so use that.
play 2.5.10 java
build.sbt
Add " com.adrianhurt "%%" play-bootstrap "%" 1.2-P25-B3-RC2 "
P25-B3 means to use bootstrap3 of play2.5 series
libraryDependencies ++= Seq(
  ...
  "com.adrianhurt" %% "play-bootstrap" % "1.2-P25-B3-RC2"
)
app/views/main.scala.html
Add <link href =" //netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css "rel="stylesheet"> to the main html
<!DOCTYPE html>
<html lang="en">
    <head>
        @* Here's where we render the page title `String`. *@
        <title>@title</title>
        <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
        <link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png ")">
        <script src="@routes.Assets.versioned("javascripts/hello.js")" type="text/javascript"></script>
    </head>
    <body>
        @* And here's where we render the `Html` object containing
         * the page content. *@
        @content
    </body>
</html>
app/views/index.scala.html
@(message: String)
@import b3.vertical.fieldConstructor
@main("index") {    
    @b3.buttonType("submit", 'class -> "btn btn-default"){ <span class="glyphicon glyphicon-ok"></span> Login }
}

Recommended Posts