[JAVA] How to use BootStrap with Play Framework

There is a convenient library called play-bootstrap, so use that.

environment

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 }
}

Complete

スクリーンショット 2018-03-21 18.37.31.png

Recommended Posts

How to use BootStrap with Play Framework
How to use Java framework with AWS Lambda! ??
How to use Play Framework without using typesafe activator
How to use mssql-tools with alpine
[Rails] How to use rails console with docker
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use java.util.logging
How to use map
How to use collection_select
How to adapt Bootstrap
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use built-in h2db with spring boot
How to use Java API with lambda expression
How to use nfs protocol version 2 with ubuntu 18.04
How to use docker compose with NVIDIA Jetson
How to use nginx-ingress-controller with Docker for Mac
[Java] How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
Java to play with Function
How to use Struts2 * Spring Framework (Spring plugin) June 2017 Version
How to use Oracle JDK 9 EA with Travis CI
How to deploy Java to AWS Lambda with Serverless Framework
[Rails] How to use enum
How to use java Optional
How to use JUnit (beginner)
How to use Ruby return
How to use Z3 library in Scala with Eclipse
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args
[Java] How to use string.format
How to use rails join
How to number (number) with html.erb
How to use Java Map
How to update with activerecord-import
Ruby: How to use cookies