Search

The browser as a platform.

What if you could use Java, CDI, and JPA in your web browser? What if you could use Java without losing any of the flexibility of HTML5, JavaScript and CSS? The answer is, you can. And that framework is Errai!

How productive can you be with Errai? We think this video speaks for itself: 

 

  

by errai at Tue Sep 17 16:12:23 EDT 2013

Get Rolling

Errai makes building your rich web application in GWT easier. We cut the boilerplate and promote annotation driven development. With Errai, everything is a bean in the client. Just annotate!

@EntryPoint
public void App {
  @PostConstruct
  public void helloWorld() {
     Window.alert("Hello, World!");
  }
}

 

Get Talking

Talking to the server is much easier, too! Leveraging ErraiBus, you can transparently and easily mix event-based and RPC-based functionality in your app as neccessary. When leveraging the bus, everything in your app is push, everything is asynchronous! 

@EntryPoint
public void App {
  @Inject
  Caller<MyRpcService> rpcCaller;  

  // ... //
  @UiHandler("button")
  public void clickHandler(ClickEvent evt) {
    rpcCaller.call(new RemoteCallback<String>() {
      public void callback(String response) { 
        Window.alert("The server said: " + response);
      }
    }).sayHello();
  }
}

 

Get Decoupled with CDI

With Errai CDI, the power of the CDI programming model comes to the browser. And it's more than injections, producers and qualifiers. You can hook directly into the server-side eventing system from the client with client observers, which directly use CDI APIs from the browser!

// this is really client code!
@ApplicationScoped
public void App {
  @Inject Event<ClientEvent> clientEvent; 

  public void observeServerEvent(@Observes ServerEvent evt) {
    Window.alert("Received an event from server: " + evt.getMessage());
  }

  // .. //
 
  @UiHandler("button")
  public void handleClick(ClickEvent evt) {
    clientEvent.fire(new ClientEvent("button was clicked!"));
  }
}

 

Get RESTful

Talk RESTful-ly to the server using Errai's JAX-RS module. Lay down a JAX-RS service:

@Path("customers")
public interface CustomerService {
  @POST
  @Consumes("application/json")
  @Produces("text/plain")
  public long createCustomer(Customer customer);
}      

And call in from a client side bean!

@ApplicationScoped
public class App {
  @Inject
  private Caller<CustomerService> customerService;
  // ... // 
  
  @UiHandler("button")
  public void handleClick(ClickEvent evt) {
    customerService.call(new RemoteCallback<Long>() {
      public void callback(Long response) {
        Window.alert(response);
      }
    }).createCustomer(customer);
  }
  // ..//
}

It really is that easy. With Errai, you cut the boilerplate. 

 

 

Get Started Right Now

Create a started project with our Maven archetype.

If you want to get started with a CDI based project, with all the bells and whistles, then copy and paste this code into your shell. (Note: you need maven installed)

 

mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.3.2.Final

 

If you need further instructions, check out this link.

Our most up-to-date documentation is here: https://docs.jboss.org/author/display/ERRAI/Home

 

         

Errai Developer Blog

Have you taken Errai Data Sync for a spin yet?
Mar 5, 2014 3:24 PM
Last June we released the first version of the Errai Data Sync module. It complements Errai JPA and …
Errai Forge Addon Release
Feb 7, 2014 3:41 PM
Many of you may have followed the recent release of Forge 2.0.0.Final. With this new release there i…
Errai and GWT: State of the Union
Nov 7, 2013 6:46 PM
If you've seen our recent blog posts, you know that work on Errai 3 is progressing quickly with even…
Category: conference Category: event Category: events
View more errai developer blog

Desktop wallpaper | Project Swag

Check out the Errai cool stuff.