Skip to content

Create your own viewrender

joris hermans edited this page Jan 24, 2015 · 1 revision

But you can also write your own 'ForceViewRender' implementation as follow. This is not needed when you are happy with the mustacheRender engine!

class FancyRender extends ForceViewRender {
  
  FancyRender(ServingAssistent servingAssistent, [views = "../views/", clientFiles = "../build/web/", clientServe = true]) : super(servingAssistent, views, clientFiles, clientServe);
  
  String _render_impl(String template, model) {
    // render logic of your template + model will become your output
    return fancy_render(template, model);
  }
}

And register your FancyRender as a component as follow:

@Config
class OwnConfig {
  
  @Autowired
  ServingAssistent servingAssistent;
  
  @Bean
  ForceViewRender viewRender() {
     return new FancyRender(servingAssistent);
  }
  
}
Clone this wiki locally
You can’t perform that action at this time.