Remarkably, I got convinced of using (or at least try out) a Google product…
Yes! Maybe unbelievable that the above sentence comes from my hands. But GWT IS REALLY COOL!
(Read further for a summary )
GWT is a Ajax client-server library that works with Java on the serverside and with Javascript on the client side. But you can just write both the server and client side in Java, the crew of GWT wrote a Java to Javascript translator. For your GUI Ajax application you can use the GWT toolkit that is, it feels like you are writing Swing applications.
For communication it works like rmi but the GWT compiler translates the clientside Java to Javascript and makes use of the http protocol. On the client side there is the actual object that will communicate with the server. The serverside should implement the same interface as the clientside. GWT has a RemoteServiceServlet class that extends from the HttpServlet that a serverside service has to extend from.
It is ofcourse still possible to add native javascript. In some case, gwt is a nice, handy and reasonably quick to make, for example, admin consoles.
It also automatically compiles the javascript files for different browsers. So no worries for compatibility, the design of your gwt app is done through CSS.
For example some ‘javascript’, a page with a panel like a java.awt.BorderLayout and sets a html element at the top.
public void onModuleLoad() { RootPanel rootPanel = RootPanel.get(); rootPanel.setWidth("99%"); final DockPanel dockPanel = new DockPanel(); rootPanel.add(dockPanel); dockPanel.setWidth("100%"); final SimplePanel simplePanel = new SimplePanel(); dockPanel.add(simplePanel, DockPanel.NORTH); final HTML html = new HTML(Config.getHeader()); simplePanel.setWidget(html); html.setSize("100%", "100%"); rootPanel.setTitle("Title"); } |