Using GWT with CMS (like Vosao) - java

I have a working website built completely with GWT. I want to test it to be used in a CMS; since using a CMS is likely to be the way for easier maintainance in the future instead of having to rewrite code so much.
Here's the reason why I use GWT:
Don't want to write JS code and manipuate pages using JS.
Most importantly I want to reuse my dynamic widgets, like the Flextable I use to populate the products page, instead of dealing with CSS and template (and stuff like that)
Bottleneck with this is that is quite not easy to use with a CMS (like Vosao)
What is the proper strategy on using GWT with a CMS?

When your site begin to grow in size and complexity.
Page counts number in the hundreds, rather than the few.
The CMS begins to become more of an application platform to achieve specific communications and informational objectives.
See this also for more discussions :GWT with a Content Management System

Related

Simple CMS functionality like wordpress

I need to develop simple CMS functionality, it supports multiple pages with static HTML ( with WYSIWYG editor)
To keep it simple, I can save the content in DB and give an ID to the page and permalink.
For every request, take the permalink ( from URL) and serve the content read from the DB.
While this is not efficient, I can think of following approach,
In the start-up and while editing, load the content and push it to the CDN server with permalink path. But, it increases the development efforts.
I have following questions based on above
1) Is it good practice to save the HTML content in DB, if not what are the alternatives ?
2) How does the Wordpress does this, So I can take design clues ?
3) Is there any very simple CMS product that I can customize, I cannot use wordpress because it has too many features, It would be better to develop the CMS rather than maintain the wordpress huge code base ?
Saving HTML in DB is perfectly fine and AFAIK WordPress does it that way.
If you would do it by yourself you can provide some cache in files (e.g. for content visible on main page).
Anyway I would prefer WordPress, since it has e.g. anti-spam filters, sitemap generations and so on. And you have all updates for free, what is really important.
As seen, saving HTML in the DB works. But definitely not the neatest approach for saving an entire page/template.
You should check out CouchCMS. The developers made use of #stacker's approach. They introduced custom tags which can be used to declare variables within templates and then the content of the variables are automatically detected and can be saved in the database using the CMS.

Integrating Javascript Frameworks with Java Web Frameworks

I have what I think might be a strange question to ask.
Recently I was playing with some java web frameworks (jsf with primefaces) and I noticed that it's quite good at handling form data or when you play along with the jsf components. I also did a project using grails and again it was useful for form data.
But the moment you want to do something which requires a little deviation; then I found myself doing weird things (examples are tag clouds with large strength values using primefaces and single page webapp forms with grails).
This resulted in some very messy html+javascript code for my grails things(which I blame on my inexperience with javascript). This was done because I was using expression language (grails in this case) to populate some of the javascript. The worst part was that I had a bunch of custom javascript code inline with my server pages (I could of refactored a little out but I think one would still have alot of javascript calls inside a single page).
So now to the question(s) :)
[main question] Are there any resources that demonstrates how to design or at least implement maintainable javascript with server pages (gsp, xhtml, etc) ?
The reason is that I find that there are some neat javascript frameworks, but using them with server pages seems a bit unnatural if one takes into account the expression languages for server side frameworks? Unless it's normal to do this type of thing :) ?
Are there appropriate frameworks for Single page webapps using java?
My current answer is that GWT, Vaadin (based off GWT) and perhaps JavaFX qualify. Maybe ZK, Flex and (Grails/Roo + Flex/GWT) also qualify as well?
Are java web frameworks still useful for presentation layers?
My current answer is that they might be when you are dealing with portal type webapps or Web 1.0 apps for lack of a better word. The other case is that they could be when you use alot of role based security and you want to filter things out based on roles, but even that has counter arguments.
My other answer to this is that it might be better to use a java server to provide your web services and then rely on something else to do the front end?
This might be OP, but for single page apps, it's easier to serve up data from the server via JSON(P)/XML/whatever and then use things like Backbone to process and modify the view(s) accordingly. That way, the server can use REST/SOAP/websockets/whatever, and the browser app becomes a full-fledged app.
I haven't actually done this, so don't quote me, but I imagine that it should make sense.

GWT Strength compared to other framework?

One of the main strength of GWT is to code in java and everything gets compiled and is loaded by several browsers through gwt deferred binding??
Apart from this, i.e. working only on a single code base, do GWT has any other advantage compared to other existing framework??
Edit:
I'm trying to say why should we use gwt and not another framework?? What is there in GWT that makes it special for web application development?? What GWT makes for us and another framework or toolkit don't do??
As i said above GWT makes deferred binding which is a plus, so I wanted what other things it do that makes it special and unique??
My point of view :
Pure Java : In standard web application you write html, css, php, javascript, mysql and others and others. In gwt you write java and java and java. Pure Java knowledge is enough for everything.
gwt-rpc mechanism is very simple to communicate with server and uibinder or any other tools are enough for ui development. plus there are many widgets that facilitate front-end developing
Debug : Debugging Java code is very very easy than debugging Javascript code
MVP Development with Activities and Places
Compiler that you can do all the thing, that you can do in Javascript, in GWT. In addition, working with JSON and XML is very easy and History management is unbleviable
and at last I'm a big big fan of Google and they did it so they did the right thing
One of the other benefits of GWT is that you can share code between the client and server components of your app. For example, if you're doing a graphical app you can write computational geometry code and have the same code evaluate on both sides. Of course, you can also do the same thing by using server-side Javascript (for example, Node.js), but server-side Java has serious advantages for performance, ease of deployment, and interoperability with other things.
My favorite benefit is their RPC mechanisms. JSON gives you a huge reduction in payload size, but GWT's serialization policies allow the data to be sent over the wire without key labels for each value and reduces payload size by another 30% or so. On top of that, its easy to build those services using Spring and Hibernate.
Another benefit is the use of md5 hashes for the filenames of compiled JavaScript, allowing you to set never expires cache headers for all of your code.
Last but not least (actually, it is the least cool of the benefits), there are free tools now for GUI design so you don't have to build a GUI by writing XML and Java or HTML and CSS.
GWT follows a principle of no compromise high-performance Javascript.
They have already invested a lot of work into making your application highly performant. For instance, the "compiled" Javascript files it generates are actually .html files. This is due to an issue that some browsers do not correctly support compressed .js files. This sort of tweaking is beyond what most people would do manually.
There are easy to use tools to help you improve the performance of your own application. GWT.runAsync, for instance, allows you to define splitting points in your Javascript which will be used to automatically divide up monolithic Javascript files into bite sized chunks to load.
As has been said, the RPC mechanism performance and ease of design is amazing. MD5 hash based names for the compiled Javascript means for great caching.
My biggest plus for GWT still has to be the debugging capabilities. Javascript debugging has always been messy and frustrating. With GWT you can employ the full debugging facilities of Java when working on your client side code.
There are no simple answers to these questions:
I'm trying to say why should we use
gwt and not another framework?? What
is there in GWT that makes it special
for web application development?? What
GWT makes for us and another framework
or toolkit don't do??
There is no silver bullet. Everything depends on the project and requirements. GWT may be good in one project and other frameworks may be good in other projects. It also depends which other frameworks are taken into account.
In my opinion the most significant element which makes GWT different from almost all other Java web frameworks is that the client side is fully in JavaScript while most of other frameworks generate usually plain HTML code. The JavaScript approach to the client has its benefits, to name a few:
it is fully AJAX which creates great user experience,
views state is managed in the browser,
it communicates with the server asynchronously;
it communicates with the server only to get the datal
However, there are also some drawbacks:
browser history support - it isn't as good as in HTML based frameworks; proper use of history mechanism isn't easy and requires extra effort from developers;
applications aren't SEO friendly;
more complicated page layouts may kill web browsers - sometimes it takes a long time to generate a page, especially when using additional component libraries;
For developers it is very important that GWT hides JS from them. You write in Java and you get fully working AJAX based client application in JS usually without touching a single line of JS. This is great especially when you need a lot of AJAX in your application and you don't know JS. This is specific to GWT - using JS and AJAX in other frameworks isn't usually that easy (Vaadin may be an exception but it is GWT based).
It is worth mentioning that in many cases GWT can be combined with other web frameworks - this way you can have most of you application content created in HTML based frameworks and some more complicated AJAX parts in GWT.
If you want a recent comparison of Java Web Frameworks, here is an interesting presentation from Devoxx 2010 :
http://raibledesigns.com/rd/entry/my_comparing_jvm_web_frameworks

How can I make the SmartGWT core smaller?

I have recently written a Hello World application using SmartGWT and noticed that the size of the application is huge. In my case it is over 600kb just for that application.
I think that size is obscene so I narrowed the culprit down to two core libraries, ISC_Core and ISC_Foundation which combine for a total size of 649kb. Is there anyway to reduce the bloat of these libraries?
Any help would be appreciated.
SmartGWT is not designed for Hello World applications, but for sophisticated enterprise applications that work with lots of entities and have lots of screens. In that use case, the final delivered size of a SmartGWT application is comparable to, if not smaller than the size you would get working with any other technology.
Basically if you tackle a larger-scale application with a flyweight technology, you end up with application code that re-creates the features that are already in SmartGWT. There's no bloat - SmartGWT is very compact on a features-per-byte basis - there's just more features.
If you really have an ultra-lightweight use case - say, adding minor interactivity to a web site that consists mostly of static content - then JQuery and other ultra-lightweight frameworks are the way to go. A lot of enterprises use a mixture of JQuery and SmartGWT/SmartClient, each for different purposes.
Unfortunately you cannot, as SmartGWT have already stated here the size will remain constant or even increase. I tried SmartGWT but because of this issue and 3rd party framework integration problems I chose another framework.
A possible solution to their problem would be to introduce a dynamic JavaScript loader like is present in ZK. I have used it in my enterprise projects and it works very well.
Nowadays for smaller applications I tend to use jQuery directly.
As Charles stated you have to keep in mind that you actually build a rich client on a single HTML page, so it's loaded just once. You can preload the libraries on a login page where nobody notices it while he is entering the credentials.
Take a look at http://www.smartclient.com/docs/7.0rc2/a/b/c/go.html#group..networkPerformance
If the foot print is really important to you, you might consider Ext GWT. Ext GWT has everything done in Java (and compiled with GWT). It techincally could remove the codes that your application doesn't count on.

GWT with a Content Management System

After seeing some of the benefits of GWT, my partner and I decided that it would be a good front end for the web app we hope to build. A main part of this web app will be content management. We were hoping to use a CMS framework and put GWT on the front end, but all the open source CMS systems we find seem to be very tied to their front end.
Does anybody know of a CMS that would work well with GWT?
I think it all depends on how much integration you want, specifically, what you want to do with GWT. We have successfully integrated GWT with Documentum + Java on the back end.
With that said, our integration is fairly light. The site is largely a content oriented website, but we use GWT to:
Implement certain more dynamic widgets (e.g., text box with intelligent auto completion, font size changers).
Enhance content in the CMS to make it more animated (for instance, instead of displaying lots of content in a single screen, we use GWT's tab panel to display chunks at a time, while still allowing content authors to manage our content).
Implement "mini-apps" within the site.
Unfortunately, since this is something I do for a client, I cannot specifically mention the site by name in public, but if you're interested, I can share some details with you via e-mail.
No, but I can tell you that using a Java based CMS will make your life much much easier. GWT lives on RPC calls, and while translation / JSON overlays are possible, you're much better off with a Java backend.
You mind find this difficult, though, because when you want to use GWT you're doing a massive amount of work on the front end, leaving the backend mostly data processing and storage. Since very few CMSs are designed to do nothing more than processing and storage, you might be better off building your own.
That said, you might find it very easy if you're open to using App Engine. The GWT + App Engine stack works really well, now has a great Eclipse plugin dedicated to it, and is free to get started with.
Try the Nuxeo CMS/EMS, which is implemented in Java. Search google for "nuxeo", and also search for "nuxeo gwt" for a variety of tutorials on integrating GWT with Nuxeo.

Categories

Resources