Question

There are lots of great Javascript libraries out there these days for creating rich web applications and I would like to use one of them for the frontend of a website I'm working on as they seem to provide a way better interface than what you usually see with JSF, Facelets, PrimeFaces, etc...I read so many complaints about the presentation layer for Java EE and on the other hand things seem to be getting better and better when it comes to Javascript and HTML5.

I am wondering how to go about doing this? One JSP and Facelets you can have items in the presentation layer directly mapped to objects on the server. How would you deal with this when instead you use a Javacript library for your frontend?

I will use Java EE on the server but what is the best way of integrating this with a Javascript RIA library on the frontend?

Was it helpful?

Solution

If your question is only about mapping objects from the back-end to the JavaScript front-end, then I suggest using a JAX-RS implementation (RESTEasy, Restlet, Apache CXF, ...) in combination with Jackson (JSON provider).

This combination allows you to publish a REST API with your domain objects converted to JSON, so you can easily access these objects through JavaScript by using AJAX requests.

But of course this leaves a lot of communication handling open to the developer, if you want to have a more complete package, frameworks like Google Web Toolkit are probably a better solution.

OTHER TIPS

A Google Web Toolkit frontend would be easiest to combine with a Java EE backend as it supports this out of the box with it's own communication system. Otherwise RESTful services are easy to communicate with from javascript and are easy to create in Java EE especially with the aid of an IDE like netbeans.

You can create a front end using JavaScript Libraries like JQuery, ExtJS, Dojo etc with HTML/ HTML5.

To communicate with a Java EE server, you can use an Ajax request with the response in xml/json format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top