Single page Web App in Java framework or examples? [closed]
Asked Answered
V

3

17

Has anyone seen an example or done the following in Java: http://duganchen.ca/single-page-web-app-architecture-done-right/

That is a design a single page web app that will work with Google SEO with out massive violation of DRY using Java technologies?

It doesn't seem terrible hard to do this on my own but I was curious (and lazy) to see if someone had already done it with either Spring or JAX-RS.

Victoir answered 19/3, 2012 at 16:15 Comment(2)
I did found this last week, using spring 3.1 and Backbones. But it does not use Mustache. github.com/sdeleuze/spring-backbone-todo. There is then the possibility to merge with that github.com/sps/mustache-spring-viewDuring
Yep I'm already using the Mustache Spring View. I'm thinking of customizing it though so that if sees the Accept type of "application/json" it sends the model through Jackson (json object).Victoir
E
8

I have built quite a large "single-page" javascript website, that generats all HTML on the client. Server provides JSON only responses. I used Google Closure tools for the following reasons:

  • Google Closure Templates allows designing templates in high level templating language (named soy) which is compiled either to pure javascript functions to run on the client or java code to run on the server site.

  • Google Closure Compiler, which allows separating javascript code to modules and provides autmatic dependency injection for uncompiled mode. Good program structure and modularisation is necessary for any project exceeding simple html decoration. This is hard to achieve with frameworks like jQuery or dojo. In advanced compiled mode it transforms your javascript to shorter an more efficient equivalent, eliminates dead code and do dramatic reduction in size, which can shrink the original codebase to few % of the original size.

  • Google Stylesheets is meta css language which works great with closure compiler.

  • Google Closure Library is huge and well tested javascript library and with closure compiler, you only take what is needed.

To streamline the development, I'm using plovr, written by Michale Bolin, a former googler, one of the members of the original Closure Compiler Team.

I can recommend reading Michale's book: Closure, the Definitive Guide.

I must but warn, the initial leraning curve might be quite steep, but it is well worth the pain. Google used this tools to write almost all their web projects.

Just one more thing

If you feel really adventurous, and want to peep in to the future, I recomend upgrading the former strategy with Clojure/ClojureScript. For the start, watch this very persuasive talk of Rich Hickey and make sure to check Clojurescript one project.

Enarthrosis answered 10/5, 2012 at 7:27 Comment(3)
We use google closure for a minimizer but I had no idea it had a templating language. I am seriously considering switching as Mustache is so limiting.Victoir
Give Closure Templates a try. Actually, it makes a lot of sense to use all google Closure tools together. They were designed to be used together. To unleash the real power of closure compiler, the code should be marked (in comments) the requested way. All Closure Library is marked that way so the compiler can do dramatic optimisation and code shrinking. Closure compiler is not just another minimizer, it is the ultimate beast!Hurtful
404 on the Rich Hickey talk but I found this one, 'ClojureScript Release - Rich Hickey' ~ youtube.com/watch?v=tVooR-dF_Ag Is this the talk you mention?Equalizer
P
0

I recommend AribaWEB for its advanced AJAX usage.

http://aribaweb.org/

Primipara answered 21/3, 2012 at 12:5 Comment(0)
L
0

Take a look to ItsNat, is a Java framework focused on Single Page Interface SEO compatible websites.

Lichenin answered 28/1, 2014 at 21:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.