Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring MVC & UI Components

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 previous question I posted several weeks ago, the SO community at large felt strongly that I would be better off going with a Spring MVC-based web app than with something in JSF. Since Spring is request-oriented, and JSF is component-oriented, it would only make sense to use Spring for something that is going to be getting a lot of asynchronous requests.

If I were going the JSF route, then my next set of decisions would be whether or not to use so-called UI component libraries for the view technology, such as PrimeFaces, IceFaces or MyFaces.

So, I'm wondering: Does Spring MVC have anything similar to, say, PrimeFaces (or its likes) for creating the view component for my page(s)? I know its not component-based, but I'm not all that familiar with Spring MVC's web platform and was wondering what are some de facto standards (if any) or typical technology stacks that Spring web developers use for constructing nice web pages.

And, if Spring just uses run-o-the-mill template engines, would something like Freemarker suffice?

I guess this is a "best practices"-type question for a budding Spring web developer.

Thanks in advance!

like image 657
IAmYourFaja Avatar asked Sep 22 '11 19:09

IAmYourFaja


People also ask

What is Spring and Spring MVC?

1. Spring MVC is a Model View, and Controller based web framework widely used to develop web applications. Spring Boot is built on top of the conventional spring framework, widely used to develop REST APIs. 2. If we are using Spring MVC, we need to build the configuration manually.

Is Spring MVC easy?

To answer your questions, Spring is easy to learn because the whole framework is designed to work with POJOs, instead of relying on special interfaces, abstract classes or such.

Is Spring MVC a pattern?

Spring MVC Framework follows the Model-View-Controller design pattern. It is used to develop web applications. It works around DispatcherServlet. DispatcherServlet handles all the HTTP requests and responses.


2 Answers

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.

like image 94
Ludovico Fischer Avatar answered Sep 26 '22 10:09

Ludovico Fischer


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

like image 35
Velu Avatar answered Sep 22 '22 10:09

Velu