Grails UI in 2.3.4 - grails

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.

Related

Grails with Vaadin plugin, is it the right choice?

For my organization I am evaluating RICH technologies for our next projects.
We are currently using grails 2.1.0 and very happy with that, especially with groovy and gorm and we would like to stay with that. The idea is to extend grails with some RICH framework/library. Currently I am evaluating: grails plugin for ZK, grails plugin for Vaadin, knockoutjs, angular.js, ember.js.
I already received a feedback from my colleagues who worked with ZK (no grails) and their conclusion was: cool, but forget performances, ZK goes to the server every time you do something at client side.
My question is: is this also true with Vaadin (plugin for Grails) ? How does it react with heavy single page applications? and what about Bambi? can this be an option?
On paper grails + Vaadin is what we need: we want to write groovy/java, not xml and surely not javascript. Is this the right choice?
I know my question is very generic, but I am just at the beginning of the evaluation...
Thank you for your attention!
Vaadin works perfectly with Groovy and Grails. You can get services (actually spring beans) by using Grails.get() method and do localization via Grails.i18n() method. Because all the code is going to be written in Groovy, not Java, it will become less heavy (less lines of code and so on...).
Vaadin doesn't go with ever user action on server. You can influence that by setting setImmediate(false) on whatever component.
When you make complex application in Vaadin, you need to be careful how many components you put on the page. If you expect that there will be thousands of components on single page, then browser renderer will have performance issues with handling it (of course speed of rendering depends on your computer hardware). More hints is here.
I recommend - try to build UI in Vaadin and fake database. Then see the performance and then switch to the real database. Usually people blame Vaadin but the problem is elsewhere e.g. in database, indexing, loading to many items at once...
If you don't want to play with JavaScript, then I suppose knockoutjs, angular.js, ember.js are out of the game.
You need to find out, whether the Vaadin components are what you need. I really suggest to try it out and make Proof of Concept in Vaadin. If not, Vaadin 7 simplifies integration with JavaScript! So, you can easily integrate Vaadin server code with whatever JavaScript library (e.g. highcharts and so on...).
You will need to get your containers lazily loaded (check this)
I think you should start with Vaadin 7 (here is a tutorial)
There will be more performance optimalisations in Vaadin 7 (in versions 7.0.1 or 7.0.2)

Web front-end tools for Grails project

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)

Concept of engine or mountable engine in Grails?

In rails there seems to be a quite popular concept of engines even for things that are not stand-alone plugins but rather tiny contained web apps running in a web application.
I know grails has plugins the supplement the main application but I am wondering if grails can have sub-applications. For example you have a main application but then want a forum sub-application that simply uses the auth & auth models from the main application so that it does not need its own.
Is there any documentation or some basic concept tutorials on the engine concept for Grails?
Essentially I want to have a small main application that deals with auth & auth and some management but get all my other features to be sub-applications like splitting out forum, news, store, blog, etc but that all rely on the auth & auth of the main application. (making for a more modular grails app)
Thanks
Grails plugins are conceptually very similar to Rails Engines. The Grails plugin system can certainly be used to create a reusable component as you describe. You can embed all kinds of functionality into a Grails plugin including domain classes, controllers, UrlMappings, and views -- most things you would put into an application can be put into a plugin and it will be merged into whatever applications use that plugin.
There is a somewhat old blog post describing this approach here. The Grails user guide also has a detailed chapter on plugins.

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.

What can I learn from Grails?

If I know Rails, what new ideas/patterns would I learn if I looked at Grails?
I have no intention to move to Grails and no need for a Java stack, but if there are neat ideas I could learn from Grails I'd like to learn them.
Grails has taken totally different direction. It is very hard to compare Grails and Rails.
Grails is not framework. It is stack of frameworks. You can find all the features you find in plain Spring, Hibernate, Quartz, Compass, Sitemesh frameworks. So at the end you get all the best from all these frameworks with convention-over-configuration.
However, I really want to mention about very interesting idea introduced in Grails about modulizing the application into plugins. Plugin in Grails is minimized independent project. Separating application logics into plugins allows to share your code to community and keep application in separate modules which results in easier testing and easier development.
Grails has at least two patterns I'm aware of that I believe do not exist in Rails:
Command objects (and auto binding request params to them)
Conversation based request handling using web flows

Resources