Web front-end tools for Grails project - grails

I previously developed only Java SE applications, and now I am trying to do some small project in Grails. My front-end developing skills are really bad. Ok, I got the main ideas behind GSP in Grails, but there are many tools which alow to simplify front-end development, like Twitter Bootstrap.
My question is, what tools for front end are best suited for Grails project and can be naturally combined with GSP?
Another option I am looking into is doing whole front-end on something like Flex, how hard is it to do such thing in Grails?

Grails is best suited for HTML+CSS+JS front-end. You still can use Flex, Vaadin, GWT, etc., if you prefer. But standard HTML + modern framework is really easier to use.
For standard web app, based on html/css/js, I can recommend Twitter Bootstrap plugin (but you aren't limited to it). It's very useful framework, but you should know all basics (html and css)

Related

Grails UI in 2.3.4

I am coming from the Spring + Hibernate + JSF/primefaces site. What I like in Grails is its scaffolding site, so that basic CRUD apps can be created rather quickly.
However, which libaries do you recommend for a beginner in Grails for creating a UI? It should be created quickly and straightforward and also be feature rich (have a look at the primefaces libary)!
The very basic GSP pages are really powerful, especially when combined with any modern JS library. With them you can assemble a complex rich GUIs in instant (well, almost :) )
There are also numerous grails plugins to include almost any view technology of your choice into your web-app, e.g. http://grails.org/plugin/kickstart-with-bootstrap
I would suggest http://grails.org/plugin/twitter-bootstrap once installed you can use the documentation at http://getbootstrap.com/ as your guide.

grails & backbone.js

ive currently been developing a Java EE project, using regular web services and backbone.js for my front end. (As i like things being loaded/added to the page, without the page refreshing (async, backbone)).
I wanted to find out if anyone has used grails along with backbone and what their experience is?
Grails would be for server side stuff, and backbone for handling the front end.
Or can grails do this itself. IE, with grails, can you dynamically load stuff onto a page without refreshing. For example, a todo list.
Is it difficult to add backbone to grails?
I've used Backbone + Grails, for two projects. And didn't see any problem, absolutelly.
Backbone is client-side only framework, very flexible, developed with idea that it should be compatible with nearly all server-side stuff. It just expecting RESTful/RESTful-like server side API. And also, you can alway use your own server-client transport implementation, see Backbone.sync (but I'm sure, you don't need it for standard Grails app)
Grails, at other hand, it very flexible server-side framework (mostly server-side). By using Grails you can make RESTful api w/o any problem. Basically you just need to respond with JSON, that's enough.
PS you can also use Grails tags for ajax, like remoteLink and plain jQuery, but Backbone is much more powerful (and easy to learn)
It's not that complex. You can try following this tutorial.
It's a Grails 2.x & BackboneJS project, which utilises the resources plugin.
The tutorial link provided by #chanwit is not working but you can use github link of same project.

Backbone.js frontend with RESTful Rails backend?

I started in the web development world with PHP, and then Rails in the recent few years. Since then I've been doing all my web projects in Rails.
Recently there seems to be a movement towards making Rails as a pure RESTful backend service and using frontend framework such as Backbone.js for all frontend interaction. I'm wondering what's you guys' take on it? Will this be the eventual future?
As well, besides Backbone.js, what are some other alternatives for frontend framework for this purpose?
Also assuming that I will want to support both a desktop version and a mobile version of my app, would this be a proper route to take? So I'll have a single backend service with different frontend services? This way I don't need to manage all the views on Rails' side?
Thanks!
For Client-side frameworks, this article has a list of 20 of them with pro's and con's:
http://net.tutsplus.com/articles/web-roundups/20-javascript-frameworks-worth-checking-out/
Here's the list:
Backbone.js
Knockout.js
Asana luna
Cappucino
Sproutcore
BatmanJS
corMVC
TrimJunction
pureMVC
jamal
choco
sammyjs
extJS
agilityJS
eyeballs
activejs
spinejs
qooxdoo
These are roughly all about creating client-side, ajax-based, javascript MVC frameworks.
If you're looking to start somewhere, then I recommend thinking about Client-Side Templates (...ates...ates...ates) (just the "V") to support a service-oriented architecture (many clients are supported by service-endpoints you create).
It's a new technique that involves modularizing your client-side code, bringing MVC to the client, and let business-logic live in the platform. A lot of Software-as-a-Service applications are leveraging them, and with the increasing sophisticated of javascript libraries and frameworks, as well as browser capabilities with HTML5, CSS3, etc. there's going to be an increasing sophistication in client-side presentation.
So learn it.
What are the benefits?
To paraphrase Linked In: for leveraging browser-caching, de-coupling your front-end client-side presentation, asynchronous load, progressive rendering (for some frameworks), performance, ajax-interaction, and more.
Several great frameworks include:
mustache
dust.js
handlebars
Google Closure Templates
Nun
Mu
kite
I highly recommend looking at Linked In's move away from JSP towards Client-Side Templates and why they choose dust.js in Linked In's front-end client-side templates throwdown for a comparison. They go into much greater detail, and research, as to why they changed their stack to support this (it involved using 3 server-side technologies), as well as their comparisons of all the frameworks they could find.
I did something like this a few years ago in .net. Is was not via proper .NET MVC and didn't use the new JS frameworks, but the principle was the same; server code returns JSON to javascript which builds the page and interactions etc.
The result was a lovely responsive website, but, maintenance was a nightmare. Be very careful to keep your JS code well organised.
Personally, I find it easier to maintain server code (in any language) than javascript so I wouldn't go down that route again.
(IMHO)
Fran
It is my opinion that contemporary web applications are moving towards this model of having RESTful back-end and all the view interactions coded in front-end. These free video tutorials from Joe Zim:
http://www.joezimjs.com/javascript/introduction-to-backbone-js-part-1-models-video-tutorial/
helped me understand backbone and how it can simplify templating and view renders.

A fast way to build a nice UI for a grails app?

I'm starting a fairly complex grails app but am a bit slow hand-coding nice user interface pages directly in CSS/HTML. Several people have recommended IntelliJ for the grails app development, and I plan to use mostly grails scaffolding for the admin portion of the site.
Can you recommend an approach or tools for building a nice UI fairly fast?
Thanks
P.S. Eventually I plan to build "skinnier" mobile version as well.
One approach might be to continue to use the grails sitemesh main.gsp and just concentrate on your functionality using the scaffold-ed pages as examples. Once you are ready to tackle the style aspect you can deviate from the grails main.gsp template and create your own tailored for your look and feel.
If your complexity includes a fairly custom UI, I don't think your going to get a free lunch. You'll have to break down and code the UI.
I'm currently using jQuery UI coupled with jqGrid to get some fairly sophisticated grid / tree behavior in my UI with not too much html coding. I'm also using the jQuery UI Layout Plugin to manage pane layout and make my app look/feel more like an app rather than a page. Grails plays real nice with the ajax needs of jqGrid.

Silverlight and Rails

Hopefully this will not spark a religious war...
We have a web based app in RoR based on an earlier version we build in .net 2.0. So we currently have both .net and RoR skills in house.
We want to add a RIA app that interfaces with the rails web app. This should be capable of running offine, with some (perhaps relational) persistence. Considering our inhouse experience we leaning toward leveraging the sliverlight framework over the likes of Flex etc.
Would appreciate any thoughts you might have.
Thanks
Dominic
If you need the application to run offline you will want to use a pure client technology. So instead of Silverlight vs Flex you are looking at WPF vs AIR.
Silverlight and Flex are thin client technologies so neither would fit into RoR very well, unless you used RoR to build web services.
A choice between Flex/Silverlight should depend on your skills and what you want the RIA to do.
There's a fair comparison here: http://extremeblue.wordpress.com/2008/04/28/flex-vs-silverlight-my-views/
But I think you should also look at "pure" javascript solutions like ExtJS or JQuery. We've had good experiences with both those libraries + RoR. JS is hot right now. Javascript engines are getting seriously quick and it's a lovely language (in some ways). Offline persistance can be implemented through Google Gears or Adobe Air.
Go with SilverLight. It's way cool. ;)

Resources