Spring MVC & UI Components

前端 未结 4 1121
情深已故
情深已故 2021-01-31 03:18

I\'m in the \"technologies selection\" phase of a small, single-page web application that will be heavily-based in AJAX, and which will report to a Java backend.

In a pr

相关标签:
4条回答
  • 2021-01-31 03:40

    Additionally apart from the things mentioned by Ludovico Fischer, if we consider the same question in now a days tech world than you can use one of the most power full thing of recent world : Angular. There are 2 sample scenario's.

    1. If your architecture is full client side: The integration is very natural for it. Spring MVC expose your service as a REST (JSON / XMl ... ) and your client application with Angular JS consume your JSON. Here the war application (Spring mvc ) must be deployed in a Servlet Container (Tomcat) and your client application can be deployed in the same server or in another server Nginx , Apache etc..
    2. If you want to keep page generation in the server side and only use AngularJS for some nice DOM manipulation so your code must be deployed in the same war (WEB-INF). Mixing the two approachs is not always a good idea. You can try thymeleaf to stay in server side page generation.

      Thus in this way you can have simultaneously the cool featuresof angular like templating, testability and clean view code.

    0 讨论(0)
  • 2021-01-31 03:42

    Typically, the value so-called UI components lies in how they keep track of user interactions on the server side by integrating with a stateful framework.

    Since you have decided to go for a request oriented framework, it would make more sense to use some well-known client-side JavaScript libraries instead. Popular choices include:

    • Backbone.js – an MVC foundation for user interfaces
    • jQuery UI for some premade widgets (calendars, etc.)
    • If you want to go down a more complex route, but with a more desktop-like feel, Sproutcore
    • Finally, if you wish to avoid JavaScript, you can useGoogle Web Toolkit, which compiles Java to JavaScript and is supposed to have good integration with Spring.

    Personally, if I don't need a lot of standard prebuilt widgets, I like Backbone.js + underscore.js + jQuery. I don't like Google Web Toolkit since it feels like writing a pidgin JavaScript, and at that point I prefer to write JavaScript directly.

    0 讨论(0)
  • 2021-01-31 03:47

    Yes, JSF is component oriented and Spring MVC is request oriented. I recommend you to have a look at Thymeleaf Template engine, which is a complete replacement for JSP Engine .... Thymeleaf Features are:

    • It allows natural templating.
    • HTML5 support
    • Higher performance by utilizing in memory caching

    Click here for more

    0 讨论(0)
  • 2021-01-31 03:51

    Here is another approach (Not JSF) to let Spring MVC to work with ZK UI components - Rich Web Application with Spring MVC CRUD Demo

    In that article, it used Spring MVC controller to communicate with ZK UI components. (all in Java code)

    0 讨论(0)
提交回复
热议问题