blade 0,3,2,0,3,1,1,0 coveralls travis-ci

:rocket: a aimple, elegant mvc framework! website →

Quick Start  |  Demo Project  |  Contribute  |  Donate  |  FAQ |  中文说明

Build Status maven-central License Gitter

What Is Blade?

Blade is a lightweight MVC framework. It is based on the principles of simplicity and elegance. If you like it, please star / fork. Thx :blush:


  • [x] Lightweight: the code is simple and the structure is clear
  • [x] Modular (you can choose which components to use)
  • [x] RESTful style routing interface
  • [x] Template engine support
  • [x] Run with jar file
  • [x] JDK8+


  • Simplicity: The design is simple, easy to understand and doesn't introduce many layers between you and the standard library. The goal of this project is that the users should be able to understand the whole framework in a single day.
  • Elegance: blade supports the RESTful style routing interface, has no invasive interceptors and provides the writing of DSL grammar.

Get Start

To get started, first include the Blade library :

Grab via Maven


or Gradle:

compile 'com.bladejava:blade-core:1.7.2-beta'
compile 'com.bladejava:blade-embed-jetty:0.1.3'

Create Main method like this:

public static void main(String[] args) {
    $().get("/", (request, response) -> {
        response.html("<h1>Hello blade!</h1>");

Run it and point your browser to http://localhost:9000. There you go, you've just created your first Blade app!

API Example

public static void main(String[] args) {
    $().get("/user/21", getxxx);
    $().post("/save", postxxx);
    $().delete("/del/21", deletexxx);
    $().put("/put", putxxx);

REST URL Parameters

public static void main(String[] args) {
    $().get("/user/:uid", (request, response) -> {
        Integer uid = request.paramInt("uid");
        response.text("uid : " + uid);

    $().get("/users/:uid/post/:pid", (request, response) -> {
        Integer uid = request.paramInt("uid");
        Integer pid = request.paramInt("pid");
        String msg = "uid = " + uid + ", pid = " + pid;


Form URL Parameters

public static void main(String[] args) {
    $().get("/user", (request, response) -> {
        Integer uid = request.queryInt("uid");
        response.text("uid : " + uid);

Upload File

public void upload_img(@MultipartParam FileItem fileItem){
    if(null != fileItem){
        File file = fileItem.getFile();
        String fileRealPath = "your upload file path!";
        nioTransferCopy(file, fileRealPath);

Route Config File


GET     /                   IndexRoute.home
GET     /signin             IndexRoute.show_signin
POST    /signin             IndexRoute.signin
GET     /signout            IndexRoute.signout
POST    /upload_img         UploadRoute.upload_img

Route Intercept

public static void main(String[] args) {
    $().before("/.*", (request, response) -> {

You may refer to these examples for additional guidance:

Used Blade WebSite


update log



Thank you very much for the developers to help in the project, if you are willing to contribute, welcome!


Please see Apache License

Related Repositories



This package adds syntax definitions for the Laravel 5 Blade engine. ...



Blade - HTML Template Compiler, inspired by Jade & Haml ...



Use the simple and yet powerful Laravel Blade templating engine as a standalone ...



Laravel Blade extensions like $loop->odd/$loop->index in foreach, view blocks an ...



A Blade directive to export variables to JavaScript ...

Top Contributors

biezhi gavinfish ScienJus SudarAbisheck Awakens SyedWasiHaider udaykadaboina shellac sumory


-   1.5.0 zip tar
-   1.5.0-beta zip tar
-   1.4.1 zip tar
-   1.4.1-alpha zip tar
-   1.4.0 zip tar
-   1.4.0-beta zip tar
-   1.4.0-alpha zip tar
-   1.2.9 zip tar
-   1.2.9-beta zip tar
-   1.2.7-beta zip tar
-   1.2.7-alpha zip tar
-   1.2.6 zip tar
-   1.2.5 zip tar