Web application using JSF-Front end and node.js-Back end

jsfnode.js

I'm planning to build a eCommerce web application(similar to http://zovi.com/) using JSF 1.2 and node.js. All front end components will be jsf components binding to backing bean. I want to achieve real time functionality ( such as displaying Today's hot sellers ,Customers who viewed this item also viewed such patterns) using node.js. And all data retrievals from database(MySQL)should be accomplished using node and display in JSF components. I'm confused in how to bind data that i get from node to corresponding managed bean property(since i bound it to corresponding JSF component).

For example on load I've to retrieve data using node.js and populate datatable component and also i should update backing bean. Is it possible with out using any web services like REST
Hope you understand this context. Please suggest some solutions.

And I heard performance of Node.js is efficient only for small web applications not for Enterprise level. Is my approach correct??

Best Answer

To understand this approach is to be familiar with the goals and advantages that each of these very different frameworks take.

Node.js is a server side solution for efficient middle tier development of a web application. Some advantages of this are that client and server code can be written in the same language allowing the domain model to exist, without translation, between client and server.

JSF is a component based web framework that allows for MVC development, and allows for a server side event model that can occur on user interaction with the client.

If you had to integrate them then ask yourself why you would need to? JSF will allow you to define your client view and server side controller simultaneously so why would you have need for a second controller in Node.js? If you decided to go with the Node.js approach then while your server side needs are met, your view still needs to be addressed which coincidentally allows you more control over the presentation of your web application than JSF typically allows.

Assuming you need to do this, the best way is to have Node.js provide business logic and data access to your separate JSF application through the use of REST based web services. I would implement a wrapper around the Node.js web services and make these wrapper calls within my JSF Managed Beans.

The only reason I see for this approach is

  • If there exists a compelling business reason, like if data can only be accessed through a third party REST based web service that happens to be implemented in Node.js, or if you need to integrate with a component that a separate development group is responsible for.

  • If you wish to learn both technologies and do not have enough time to learn them each separately.