1

Within a Java shop, we are using Spring MVC, some HTML output and some JSON/Rest output as a service. Our client side is more familiar with jQuery for ajax messaging to the server. We have been able to build Ajax applications but the approach is cumbersome with just jquery and java code. What are some approaches for building ajax apps that don't use the single page application approach? For example, are there libraries that would support ajaxy widgets on the client side? In angularjs you can achieve this with directives.

Mainly, it would be nice to have a better javascript client side library like with Angluarjs that uses a client side MVC approach.

I have seen Ajax oriented architectures that use AngularJS with $http REST calls. Without using angularjs and single page oriented applications, what are approaches for building ajax based applications. Our current approaches have been Spring MVC HTML output and some Ajax request calls using jQuery. Are there are different approaches without the SPA approach?

3
  • IMHO, it's still a bit fuzzy to know what exactly you're looking for. As an alternative, I have had a good experience with ractivejs.org, it's like a lightweight angular. You can use plain old jquery ajax to update the model, hence the view, or wrap it into "components" (widgets) ...dunno if it fits what you're looking for though.
    – dagnelies
    Commented Feb 25, 2017 at 19:40
  • 1
    Take a look at vuejs.org
    – caisah
    Commented Feb 26, 2017 at 8:27
  • Does reactjs only work for single page applications? Commented Feb 26, 2017 at 18:54

1 Answer 1

1

Before SPA's came around people did what you are suggesting all the time. They would just add javascript to a page, hook up jquery event handlers and update the dom with them using ajax requests. It's a pretty manual approach but it works.

Personally I like everything angular and similar frameworks offer. If your goal is not to avoid angular but instead to be able to serve pages from your server but have widgets that are easy to create and add value where appropriate I would suggest instead to look at using angular apps as widgets on your page. Then you can still serve your pages but also serve widgets where appropriate for highly interactive areas.

You would need to manually bootstrap each widget to make this work. You can follow the following link for manual bootstrapping.

https://docs.angularjs.org/guide/bootstrap

1
  • "They would just add javascript to a page, hook up jquery event handlers and update the dom with them using ajax requests. It's a pretty manual approach but it works." That is OK but it is tedious and hard to unit test. It would be nice if you had a "ajaxytextinput" that I could just easily apply to the page. Commented Feb 26, 2017 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.