The Output page(Response page) of my Application, will given by JSP only.... Then what is the use of GWT at client side - gwt

I want to develop a Web Application by combining Spring Framework, GWT, Servlets, JSP........
I plan to develop Server side using Spring,Servlet ,JSP....
And for Client side, GWT....
The Output page(Response page) of my Application, will given by JSP only....
Then what is the use of GWT at client side....
please clear my doubt....

Read the following
1) AJAX - http://en.wikipedia.org/wiki/Ajax_(programming)
2) RIA - http://en.wikipedia.org/wiki/Rich_Internet_application
3) GWT - http://en.wikipedia.org/wiki/Google_Web_Toolkit

The problem with using purely jsp to create a web application is that each user interaction typically requires the entire page to be reloaded. Depending on what you're doing this approach is considered outdated. GWT is built on top of javascript and xhttp requests, allowing user interactions to affect only relevant portions of the page. This generally results in a faster and smoother user experience.

If you have already decided that you want to use JSP, then you don't need GWT. Although you could use it to create custom dynamic components and embed them on your page. Or to create a part of your application where you find JSP not sufficient (which would be probably a part that should be more 'dynamic' and would require a lot of javascript).
http://code.google.com/webtoolkit/overview.html#how

Related

Handling element attributes based on user roles in GWT

I am trying to tackle a quite common scenario in GWT based application.
If user has role 'ROLE_A', then show him only 'Search' button. All the
other buttons will be disabled.
One way to address this is by calling an async service to get the user's roles and then handle the visibility/accessibility of different UI components.
Is there any generic way in GWT to address authorization? I referred to Handle Authorization in GWT application and Using GWT Generators for custom annotations but couldn't get whatever I need.
I'm using GWT 2.4.0 with Spring 3.0.5.
Any pointers would be much appreciated.
The way I do it (and I think how it should be done, really) is to include the roles into the HTML host page, rather than getting them through an additional request. Have a look at my dagger-guice-rf-activities archetype for an example (using Guice and Servlets security, but easily transposable to Spring)
Then on the client, use plain Java ifs to handle the UI. And for those big parts of the app that only some users will see/use, use code splitting so other users don't have to download too much code.

Making a webserver using jsp and java

Using Google App Engine SDK:
webpage: http://hwsejk.appspot.com/
I'm trying to make a web server using java and jsp (it is a web server for an iPhone application). I don't know a lot about java so I'm having a lot of troubles trying to construct a server by myself. For now, I have tried implementing cookie, database, and some other methods. Now that I've given you basic information about my web server, I have a few questions to ask.
Is it the right approach to use java and jsp to make a web server like this? the java servlets get and send user inputs to different jsp pages, which contain some HTML and java code. But I've found some posts here that it's a bad practice to use jsp like this. I don't know how else I can make webpages. Could anyone please recommend the right approach to make a web server (like the one linked above)? I would love to know if there is some kind of a template that I can take a look at.
What you are making doesnt seem to be a "server" at all but rather a "web application" or "web site". The former implies you are creating a piece of sfotware to implement a specific protocol like HTTP, FTP, etc. while the latter is making a series of web pages or and application that runs on server.
You can create a web application in any number of languages, not just Java. From the screenshot you shared i would think that using Rails (Ruby), Django (Paython), or Symfony2 (PHP) would probably get you up and running pretty fast as it looks like you dont need much more than some basic model scaffolding with a pretty face.
If you are familiar with Java you might also want to try the Play! framework...

Architecture Question: GWT or Vaadin to create Desktop Application?

We're planning on creating a feedreader as a windows desktop- and iPad application. As we want to be able to show Websites AND to run (our own) JavaScript in this application, we thought about delivering the application as HTML/CSS/JavaScript, just wrapped by some .NET control or a Cocoa Touch webbrowser component. So the task at hand is to find out which framework to use to create the HTML/CSS/JS files to embed in the application.
For the development of the HTML/CSS/JavaScript we would be happy to use Vaadin, GWT, or some other framework, as we're a lot better with Java than with JS. We favor Vaadin after a short brainstorming, as the UI components are very nice, but I fear that most of the heavy lifting will be on the server and not in the client (and that wouldn't be too nice). We would also like GWT, but the Java-to-JS compiling takes a lot of time and an extra step, and slowed down development time in the past when using it.
The question is: which development framework would you choose (given you wanted to implement this project and you mostly did Java so far) and why? If there are better framework options (List of Rich Client Frameworks), please let me know.
Edit: The application will need to talk to our server from time to time (sync what has been read for example), but mainly should get the xml feeds itself. Therefore I hope that most of the generated code can be embedded in the application and there doesn't need to be heavy activity with our server.
Edit2: We (realistically even if you doubt) expect at least 10000 users.
Based on my experience with Vaadin, I'd go for that, but your requirements are somewhat favoring pure-GWT instead.
Vaadin needs the server and server connection. If building mostly offline desktop application, this can be solved with an embedded Jetty for example. (synchronize with an online service only when needed), but for iPad you would need to connect online right away to start the Vaadin application.
GWT runs completely at the client-side and you can build a JavaScript browser application that only connects when needed.
Because Vaadin is much quicker to develop, you could build a small Vaadin version first and see if that is actually problem on the iPad.
On the other hand, if you can assume going online right away, you can skip the local server installation altogether. Just run the application online and implement the desktop version using operating systems default browser control (i.e. the .NET control you suggested). Then Vaadin is easier.
Vaadin is just framework base on GWT but have two very important features:
don't need to run GWT compiler. It is pure java. Of course if not add addons because then gwt compiler must run.
you don't need to write communication code. So you don't need to solve DTO problems, non-serializable object mappings and dont need to write servlets.
I use Vaadin in my work for one year and we haven't performance problems yet (desktop like application with ~500 users). IMO very good solution is to use Vaadin just for UI, logic move to independent beans and connect this two elements using Spring or Guice.
In this case you should use MVP pattern and Domain Driven Development.
Bussines beans is domain objects and logic that use view interfaces to send responses.
Custom Vaadin components (could extends standard components) implements view interfaces.
That way is good when you decide to change UI engine if Vaadin is not for you. Just rewrite guice/spring mappings and write new implementations of view interfaces.
My 3 cents:
If you decide to use vaadin, You will benefit from already GOOD LOOKING components. Since you dont want to write (alot of) CSS , vaadin is already good looking out of the box. How ever, Vaadin is a SERVERSIDE framework. User interface interactions will hit the back end even if they dont involve getting any data (e.g moving from one tab to the other) .
If you decide to use GWT, you will have to atleast style the application (this is not hard) . There is also the problem of long compilation time (but you can test and debug on hosted mode which allows you to run the application without compiling , then you compile only when deploying). The main advantage of gwt is that you control what gets sent to the wire, For UI interactions that dont require getting data from the backend, it will work purely on the client side. You the developer will determine when to send a request to the back end. (Doing RPC requests in GWT is very easy)
Hope this will help you make the decision.

Differences between GWT and Vaadin

Can anyone suggest whether "GWT" or "Vaadin" are a better choice to design an application? Also: what are the differences in coding style?
In GWT application logic is normally run on client side. It only calls server when it needs to read/save some data.
In Vaadin application logic is on server side. Client side must normally call server after every user interaction.
GWT advantage:
App logic (replies to user interaction) is faster as it is run locally in the browser. It's also relatively insensitive to bad network conditions. Network is used only when needed (to read/save new data), which saves net traffic (important for high traffic sites).
In this regard Vaadin is slower and introduces a lag in UI interaction which is annoying to user. If network is bad this will show in UI responsiveness.
Vaadin advantage:
App logic is run on the server so it can not be inspected by the user. Arguably (Vaadin claims) that makes it more secure.
A few more points:
A fundamental difference is that in GWT you have to separate your application into Client and Server code, no such distinction in Vaadin. This will affect the architecture of your application.
In GWT client code, you must code in Java, and have a limited subset of language features available (that the GWT compiler can translate into Javascript). In Vaadin, you can code in any JVM language, since everything runs in the server (I'm using Vaadin with Scala). This may or may not be relevant to you.
GWT compilation is VERY slow, although in development mode you have the emulator. This makes production environment updates painful (a GWT application I developed has grown pretty big, and currently takes around 15 minutes to compile).
It's very simple to extend GWT with 3rd party widgets, or roll your own. Creating new Vaadin widgets is more complex.
Another Vaadin advantage: you don't have to design or implement the client-server communication, that's built-in.
With Vaadin you can also use built-in GWT when you want to do something on the client-side. This gives you both simplicity of server-side programming model (no communications, no browser programming needed) with being full control of what happens in the browser.
Differences between Vaadin and GWT:
A) Vaadin includes a server-side development model that:
Cuts number of code lines to half by reducing layers one has to
implement for user interface.
Allows you to use any JVM based language for user interface - Scala,
Groovy
Increases security by keeping user interface logic in the server
Allows synchronous calls to any backend API from the web server
Allows use of any standard Java libraries and tools for UI layer- in
server side architecture applications
Does not need Java to JavaScript compilation step that often takes
time or makes tooling complicated in GWT projects - instead you have
the Vaadin client engine
Provides server push out of the box with no extra code needed
B) Vaadin provides a large set of high level user interface components. For GWT one would need to use commercial Sencha GXT for comparable component set.
C) Vaadin includes SASS based Valo theme engine that makes it easy to build good looking custom themes from your application. Valo is the latest theming for Vaadin.
D) Data binding: Vaadin has incorporated the ability to associate any widget directly to a data source such as database, file or anything else in the server-side. This enables to define default behavior of the widgets to act on data sources.
Vaadin vs GWT
tl;dr
whether "GWT" or "Vaadin" are a better choice to design an application
It is not an “either-or” question.
With Vaadin, you get GWT (or its counterpart, Web Components) plus much more.
Vaadin is a framework for building desktop-style web apps by writing pure Java code on the server-side including declaring a user-interface. That user-interface is rendered in a web browser by Vaadin automatically generating on-the-fly the necessary browser code: HTML, CSS, JavaScript, etc. Business logic executes only on the server-side. User events (buttons clicked, data typed into fields, etc.) on the web client trigger Java code to run on the server side.
How that browser code is generated and executed, and how the client and server communicate, depends on 3rd party technology:
In Vaadin 8 and earlier, GWT
In Vaadin 10 and later, Web Components
Vaadin 8 and earlier uses GWT
Vaadin 8 and earlier was built on top of Google Web Toolkit (GWT). GWT has been spun-out of Google, as a fully open-sourced project: http://www.GWTProject.org/
GWT cross-compiles Java code into standalone JavaScript files. GWT provides other important features such as support of UI components and client-server communications.
The Vaadin Ltd company is a major supporter of GWT, including having hosted GWT developer conferences, and providing consulting expertise services.
Vaadin is only one of many products built on GWT.
Vaadin 10 and later uses Web Components
Vaadin 10 and later, known as Vaadin Flow, is a major rewrite of the framework. Instead of using GWT underneath, Vaadin Flow is built on top of Web Components technology.
Web Components is actually a suite of technologies including Custom Elements, Shadow DOM, and HTML Templates. These technologies are now built into most every modern web browser, and supported on many older browsers via polyfills.
Writing a new widget component for Vaadin is much easier with Web Components than with GWT. And most any existing Web Components based component can be wrapped to provide access via Java from the Vaadin server-side framework.
I don't have a source at hand to cite, but as I recall, Web Components based widgets may run faster and use less memory than their GWT-based equivalents.
By the way, both generations of Vaadin depend on some other technology, such as the Atmosphere library for help with WebSocket and HTTP.
I haven't tried Vaadin. I'm a GWT fan, but I CAN say that I've been a bit disappointed by the default widget set provided with GWT. You really need something like SmartGWT to fill the framework out.
I belive Vaadin is a much more advanced framework than GWT
BUT
When it comes to optimise performance on the client side there is nothing much you can do unless you build your own components (and that's where the beauty of Vaadin stops)
In a project i'm working right now 90% of the staff I've done worked as a charm
And then I had to use an event timeline next to a couple of tables. When I loaded more than 400events on the timeline my web page was almost unusable not to mention terrible slow on initialisation. I've been trying to optimise the code the last two months. At the end I used a GWT component.
As any application has to show display information coming from the server, a major requirement for simple coding is automated data binding to your forms and tables.
With Vaadin, this is as simple as a few lines of code.
In GWT, first you have no table mapping.
As for forms, you can map an object to a form, but to do so you have to implement a so called GWT Editor for your object (and one for every object inside of it). An Editor is nothing else than the definition of the form to use to show/modify the object. So all in all, there is no automation here.
GWT enables you to write web-clients with Java. The GWT cross-compiler creates JavaScript code for the client-side. You have to care for the server for your own as well as client-server communication. The generated client-code is already optimized for many browsers. My personal opinion is, GWT was very popular until Google focused on Angular. Today it is not much popular anymore.
Vaadin provides two different solutions:
1) a UI widget-set based implementing the web-component standard, and
2) the Vaadin serverside Java framework. It allows you to write web-clients with Java. However, Vaadin generates the web-client through runtime on the server dynamically. Vaadin cares for the entire client-server communication. For rendering the UI, Vaadin until version 8 used a pre-compiled UI widget-set. Vaadin from version 10 uses the Vaadin web-components.
Further benefits of Vaadin:
You do not get in contact with HTML and JavaScript and you need not bother for DOM manipulation, browser history and other low-level problems
The serverside architecture provides better security
Modern themes
Individual styling with CSS
RapidClipse provides a powerful UI builder for Vaadin based on Eclipse containing a Vaadin <> JPA databinding, internationalization, UI persistence, extended Hibernate tools, JPA-SQL query language and MicroStream integration for creating Java in-memory database apps and microservices

Comparing GWT and Turbo Gears

Anyone know of any tutorials implemented across multiple web application frameworks?
For example, I'm starting to implement GWT's Stock Watcher tutorial in Turbo Gears 2 to see how difficult it will be to do in Turbo Gears 2.
Likewise, I'll be looking for a Turbo Gears 2 tutorial to implement in GWT.
But I hate to re-create the wheel - so I was wondering if anyone was familiar with such projects and/or would be interested in helping me work on such a project.
Thanks,
--Spencer
While it is possible to combine the two frameworks, I hope to convince you not to do so.
Most web-frameworks, including Turbogears, have server-side page flow management. A page is served to the user by generating html, user interacts by clicking on links or by posting a form, the browser sends a fresh request to the server, and finally server responds with new html altogether. You AJAX'ify the page by using a js library, or the framework has some support. But, in general, transition from one view to another is done on the server side.
GWT is totally different. There is only a single HTML page in the system. Once this page is downloaded, everything happens on the browser through javascript. When the user clicks on a link, its essentially just a javascript function call. History management is done through fragment urls (the portion after the #).
These two philosophies are poles apart. So apart that I daresay GWT doesn't work well with any server-side web technology. See this discussion on GWT vis-a-vis JBPM/Struts/Spring Webflow. And see this discussion on GWT v/s JQuery.