• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

which UI to use with spring

 
Greenhorn
Posts: 10
Hibernate Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In spring web mvc I couldn't find some fundamental layout features such as decorating templates (separating columns, footers, headers, etc. into reusable jsp files). I read several opinions on the web that the best UI to use along with spring web mvc is apache tiles. Some said that it can also be sitemesh.

Lately I've been trying to use Apache Tiles with my spring project and I'm somehow disappointed, because it is not as developer-friendly as I expected. Tiles implement composite view, whereas sitemesh implement decorator pattern. This is fundamental difference, since decorator is easier for developer to use and - imho - more flexible (e.g. it enables to override variables in the child views, not in xml definitions). I would like to get your opinions on where Tiles (a composite-view-based templating engine) can be better than a decorator pattern? And what do you use?

Yep, as you can see, I'm a JEE newbie ;) I've been working in PHP until now and I must say that almost every PHP templating engine has all important features built in (no need to include .tld files). In JEE you've got to use JSP + JSF or Tiles or Sitemesh - I wonder why isn't it just all included in spring web mvc? I can't imagine a big website that doesn't have a well-implemented templating engine (e.g. inheritance) - this forces the developer to choose several tools to build only the UI part of a system (django, ruby on rails, symfony - they cover all those topics all by theirselves).
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go here and scroll down to the part titled Composite View vs. Decorator

http://tiles.apache.org/tutorial/pattern.html


Spring MVC handles view resolution. The view implementation is left up to the developer, I would rather not have to choose one. I appreciate the fact that different view implementations are better for different use cases. Whether I choose JSP, static HTML, Freemarker, Velocity, JSF etc. I have that choice. A lot of thought has gone into the development of each of these and Spring MVC does not look to redo that work but rather to make it as painless and flexible as possible for the developer to use any of them.

Besides rendering a view there is the problem of mapping requests to a handler (while remaining flexible), resolving the view to render, handling things like locales, and themes, data binding, validation, form uploads etc. This is the type of thing Spring MVC focuses on. It really revolves around the Dispatcher Servlet which is an implementation of the well known J2EE front controller pattern.


Hope that helps
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, me personally. I dislike Tiles very very much.

There is Thymeleaf which a lot of Spring guys use and really like. My friend Michael Isvy wrote a great post about it here
http://blog.springsource.org/2012/10/30/spring-mvc-from-jsp-and-tiles-to-thymeleaf/

Now I personally don't like jsp pages or any server side rendering of pages. I prefer the Single Page Web App with AJAX/REST calls to my serverside, where the server side only returns json data (after the initial index/home request) Then on the client side I use ICanHaz.js, which is built on top of Mustache. It is a very simple to use templating engine. Probably more similar to what you had in PHP.

Mark
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Funny you bring that up Mark. I was thinking for awhile now about reading http://www.manning.com/mikowski/
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bill Gorder wrote:Funny you bring that up Mark. I was thinking for awhile now about reading http://www.manning.com/mikowski/



Yeah, I think today's good websites are moving away from the old style Enterprise Java applications with the Servlet/JSP spec and moving towards more cleaner approaches.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic