Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 735
Adam Gent Avatar asked Mar 19 '12 16:03

Adam Gent


People also ask

Which framework is used as a single-page application?

Developed by Google, AngularJS is one of the open-source, front-end, JavaScript-based frameworks widely used in creating single-page applications on the client-side.

What are some examples of single-page applications?

Some examples of Single Page Applications are Gmail, Google Maps, AirBNB, Netflix, Pinterest, Paypal, and many more. Companies are using SPAs to build a fluid, scalable experience.

What is single-page application in Java?

A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of a web browser loading entire new pages.

When should you not use a single-page application?

Single-page apps use JavaScript, so it can be difficult to trace errors. Users need to turn on JavaScript in their web browser or the application won't work. Memory leaks may result in a performance dro . Single-page apps are not suitable for enterprise-based applications, only for small and mid-size applications.


1 Answers

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.

like image 194
Aleš Kotnik Avatar answered Sep 28 '22 01:09

Aleš Kotnik