Experiences with java-based webapps and "new" template engines

249 views
Skip to first unread message

zentr...@yahoo.co.uk

unread,
Aug 9, 2012, 9:56:05 AM8/9/12
to java...@googlegroups.com
I'd like to hear people sharing their experience with java-based webapps and using templates that are not JSP or anything in the JSTL-Velocity-Freemarker world.

We're running a few webapps (some spring-based, but not all of them) and from the front-end room we only hear cursing and crying, so to speak.

These guys are very good html/css/js developers and had enough of jsp/jstl.

We've been trying to de-couple a little bit and started experimenting with other stuff.

I personally tried scalate and liked it but I'd like to hear more from anybody who's using these things fulltime.

Handlebars, Mustache, Angular... you name it. How do they integrate with a java webapp?

Also, since we deploy our war on glassfish, how could we set it up so that front-end changes WON'T need re-deploy?

ps: Scalate guys suggest to ask this question beforehand: Who edits the templates? Maybe it's the right question to ask.

pps: no, we're not moving to Play or Scala or Rails

Steel City Phantom

unread,
Aug 9, 2012, 10:44:34 AM8/9/12
to java...@googlegroups.com
JSP is fast but thats because it has virtually no features.  JSF, IceFaces, RichFaces, those three are useless.  Great in concept but horribly slow.  Ive had nothing but performance problems with them (in my world, if it takes more than half a second to refresh something, its useless) faces usually takes around 5 - 10 seconds.  On one project i did a number of years ago, i had one of the Richfaces guys on the wire and was explaining to him that my problem with the framework was that going from one blank page with only a link on it and no backend code, to another blank page with no backend code took well over a second and a half.  he looked at me and went, whats the problem, thats fast as hell.  I was dumbfounded.


at the moment, we are doing a prototype with Vaadin/GWT and are quite impressed.  its fully featured, fast, and its a true event driven UI.  much improved over the typical form post UI's that a lot of other frameworks use.  

i would put Spring MVC on top of your existing system, and then try different frameworks.  take your BL layer and do one or two features with Vaadin, then create another project with Handlebar, or something else.  try em out and see how well they work for you.  


--
You received this message because you are subscribed to the Google Groups "Java Posse" group.
To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/kOIqNA3_TTsJ.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.



--
You want it fast, cheap, or right.  Pick two!!

Kevin Wright

unread,
Aug 9, 2012, 11:01:16 AM8/9/12
to java...@googlegroups.com
Jade in scalatra + twitter bootstrap + backbone.js

Mostly, the client-side code is implemented in JavaScript, but I find that Jade is particularly efficient at producing elements with the css classes that bootstrap uses.
Scalatra then gives a very clean routing definition and, with the Akka support and Futures, one of the cleanest solutions I've seen for implementing an asynchronous 3.0 servlet.

Admittedly, I'm running on a full Scala stack.  But there's absolutely nothing to prevent you from using Scala for just the routing definition + templates, and Java for everything else.  Even if you wanted to use the async/future capabilities, Akka has a very good Java API available.

clay

unread,
Aug 9, 2012, 11:50:02 AM8/9/12
to java...@googlegroups.com
If your front end devs that are more comfortable with HTML/JS/CSS, why don't you use a strictly HTML/JS/CSS front end that talks to Java REST services and drop the server-side HTML templating engine?

Kevin Wright

unread,
Aug 9, 2012, 12:10:09 PM8/9/12
to java...@googlegroups.com
It's never that clear-cut :)

A server-side framework can speed things up a great deal by handling less/sass/scss compilation, js minification, template pre-compilation, etc. all at compile time (and yes, this is how I use scalatra)

It also allows you to work with a much cleaner, DRYer syntax which then emits code for a framework such as bootstrap.

Plus... You then already have a framework available to produce those RESTful JSON resources that the client-side stuff will be consuming!

Shaine Ismail

unread,
Aug 10, 2012, 1:18:57 AM8/10/12
to java...@googlegroups.com

Regards
Shaine Ismail

Sent from my mobile.

--
You received this message because you are subscribed to the Google Groups "Java Posse" group.

zentr...@yahoo.co.uk

unread,
Aug 10, 2012, 4:13:45 AM8/10/12
to java...@googlegroups.com
@scphantm no jsf or gwt here. sorry.

@KWright no scala and no java+scala mix. sorry. (yet, though I tried scalatra and play-scala and will try to introuce these guys sooner than later)

@clay your solution will solve the decoupling issue. though i'm afraid it's a long shot from what we have now.

Thanks everyone. I'm still leaning more towards scalate. The issue with wrapping static assets into my war still stands though

zentr...@yahoo.co.uk

unread,
Aug 10, 2012, 4:51:53 AM8/10/12
to java...@googlegroups.com
just found this https://github.com/neuland/spring-jade4j
i'll give it a try

Mark Derricutt

unread,
Aug 10, 2012, 6:47:33 PM8/10/12
to java...@googlegroups.com
Also, Dhanji ( of Sitebrix, Guice, Google Exit Rants fame ) just released his new java based Jade-like template library:


Unlike the original Jade templating engine, this uses the MVEL expression language instead of javascript for expressions. Looks nice.

Mark
Reply all
Reply to author
Forward
0 new messages