Web Client Programming

Juzu makes client side programming easy as it supports declarative assets for JavaScript and Stylesheet.

You can also easily reuse client-side web libraries in your project with the Webjars support.

@WebJars(@WebJar("jquery"))
@Scripts(
  {
    @Script(id = "jquery", value = "jquery/1.10.2/jquery.js"),
    @Script(value = "javascripts/myJs.js", depends = "jquery")
  }
 )
 @Assets("*")

Controller

Process all the requests of your application using controllers: a simply annotated method of the application with @View, @Action, @Resources or @Event.

Controllers request parameters can be Primitive Types, Multivalued Type and Bean types.

@View 
public Response.Content index() { 
  ...
}

@Action 
public Response login(@Mapped User user) {
  ...
}

Graphical component libraries

Create your own libraries of Graphical Component and reuse it in any Juzu application by implementing simple tags.

Simple tags allow creation of custom tags with templates.

//my reusable footer
<div class="footer">
Created with <a 
href="http://www.github.com/juzu">juzu</a>
</div>

Dependency Injection

Declare your custom bean in one place and use them anywhere in the application using the @Inject annotation.

Let the IOC container managing the service lifecycle (instantiation, inject dependencies).

@Bindings({
  @Binding(
    value = org.juzu.tutorial.services.SecretService.class, 
    implementation = 
  org.juzu.tutorial.services.SecretServiceImpl.class, 
    scope = Scope.SINGLETON)
  })
  package org.juzu.tutorial;

Modularity

Juzu can be extended with plugins and template engines.

LESS plugin

The LESS plugin compiles .less files to .css files during the compilation of the project:

@Less(value = "bootstrap.less", minify = true)
package my.app;

Webjars plugin

Reuse web assets in your project with the Webjars support:

@Application
@WebJars("jquery.js")
@Assets(scripts = { @Script(id = "jquery", src="jquery.js") })
package my.app;

Portlet plugin

The portlet plugin is able to generate a Portlet class for running the Juzu application. It also provides dependency injection for Portlet Preferences:

@Inject
PortletPreferences prefs;