How to use ember.js and struts together


#1

How to use ember.js for Client Side and Struts Framework for Server Side for an Application. Is it possible? I am Confused!


#2

I’m not all that familiar with Struts, but from what I understand it’s meant mostly for creating server-rendered web applications. Ember is more meant to replace server-rendered views and interact with some sort of API. So if you just write a headless REST style API using Struts it should be very easy to use Ember with it. If you wanted to frankenstein the Struts views and some Ember application code you may be looking at a much weirder and more difficult project.

FWIW our company is almost finished replacing our administration panel, which used to be server-side rendered with Scala/Play, with an Ember app. The benefits we’ve seen have been pretty huge especially in terms of speed. Since an Ember app doesn’t have to load a new page every time but only loads a bit of data via AJAX it looks much smoother, performs much better, and is generally way more approachable.

So my recommendation would certainly be to write a headless API on the server-side with Struts or whatever framework you prefer, and then use entirely Ember for the front end. As for how to make that work… I’d either use the JSON API format (though struts may not necessarily support that out of the box) or go with a conventional REST model and use the Ember REST adapters/serializers. You can always ask more specific questions in this forum or on StackOverflow. Good luck!