Coder Social home page Coder Social logo

scalatra-thymeleaf-support's Introduction

Scalatra Thymeleaf Support

This is an extension to Scalatra which enables to use Thymeleaf as Scalatra template engine instead of Scalate.

Scalatra

Scalatra is a tiny, Sinatra-like web framework for Scala. Here are some contributed extensions to the library.

https://github.com/scalatra/scalatra

Thymeleaf

Thymeleaf is a Java library. It is an XML / XHTML / HTML5 template engine (extensible to other formats) that can work both in web and non-web environments. It is better suited for serving XHTML/HTML5 at the view layer of web applications, but it can process any XML file even in offline environments.

http://thymeleaf.org

How to use

Added library dependency to sbt settings.

"com.github.seratch" %% "scalatra-thymeleaf-support" % "2.0.2"

And then mix ThymeleafSupport to ScalatraServlet/ScalatraFilter.

import scalatraext.thymeleaf.ThymeleafSupport

class MyServlet extends ScalatraServlet with ThymeleafSupport {

  get("/") {
    render("index", // webapp/WEB-INF/layouts/index.html
      "name" -> "Alice",
      "items" -> Seq(1,2,3)
      "data" -> Map("foo" -> "bar")
    )
  }

}

License

Apache License, Version 2.0

http://www.apache.org/licenses/LICENSE-2.0.html

scalatra-thymeleaf-support's People

Contributors

eugener avatar seratch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

eugener

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.