I need help setting up an Ember.js application to work with a Java backend running on Tomcat. I’m familiar with basic Ember concepts but I’m confused about how to connect it to my Java servlets. Should I create REST endpoints instead of using traditional servlet mappings in web.xml? What’s the best approach to handle communication between the Ember frontend and Java backend? Any guidance on project structure or configuration would be really helpful since I’m just starting with this stack.
Interesting setup! Are you planning to serve the ember app as static files from tomcat or use separate servers? Also curious why you went with servlets instead of spring boot - that might make the REST setup smoother. Have you figured out authentication between them yet?
for sure! using REST is the way to go. ember loves JSON, so skip the old servlet mapping stuff. make those servlets return JSON and handle the common requests like GET, POST, etc. i also place my ember build right in tomcat’s webapps dir and set up CORS for smooth comms.
I’ve done this exact setup before. You need a proper REST API layer - convert your servlets to handle JSON requests and responses. Use Jackson for serialization. Point your Ember adapter to the servlet endpoints. For project structure, keep the Ember build separate from your Java project at first. Deploy the built Ember app to Tomcat’s webapps directory and have your servlets handle API calls under /api. This makes development way easier and lets you deploy independently. Don’t forget CORS headers in your servlets if you’re testing with Ember’s dev server.