Any good tips for a PHP programmer starting a GWT project? - java

Coming from PHP with some Java Struts 2.0 experience any tips/tricks on learning GWT? I have been looking at some tutorials but just wanted to know if anyone has some great gems to pass along?

As someone that has done PHP, Struts2 and GWT, a good tips from me for someone that is coming from web framework like Struts2.0/PHP would be:
Throw away the old mindset, the mindset that a web framework works in request-response way. That's not how GWT works. GWT is a full ajax framework. Get a good understanding of AJAX and throw away those old mindset to get a good grasps of GWT.
Think in application development and not website development. That would affect the way you build navigation in your application with GWT.
You are not building hyperlinks to navigate between html pages, but you are using an event listener to update a partial content in your application. Get a good understanding of this.
With that in mind, always remember that you are not throwing back full html pages, but just updating a partial content in your application
Get a good understanding of Java anonymous class and inner class because you will use this alot in GWT. This is something that is used rarely if you are building with Struts2.0
The last tips would be to learn how to organize your code. If you can do it from beginning, please do so. Because you can write everything in one class if you want to. A good tip would be to take a look at this video on best practice on GWT.

Nothing beats Google's GWT quickstart (IMO):
http://code.google.com/webtoolkit/gettingstarted.html

I agree with karim79. Also add this to your list: http://examples.roughian.com/

GWT developers still need good HTML and CSS skills. It is sometimes useful to build up chunks of HTML on the client or server side (performance, skinning etc.) and not build every part of your GUI using GWT Widget trees in Java code.
Our framework (GWT Portlets) will help you structure your application. It includes a simple demo application in its own directory that you can copy to start a project.

Related

Web application frameworks without needing to write HTML/UI

Any there web application frameworks without needing to write HTML/UI?
I want to develop a web application from end to end but I am not familiar with HTML/UI, so looking for a Java based framework or tool which generates UI/HTML code automatically without actually writing HTML code (like Eclipse's UI designer plugin).
So can anybody suggest if there are there any tools/plugins to do that?
There cannot be a single correct answer to this question and I agree with the initial comments. However, three technologies that came to mind instantly:
Google Web Toolkit, GWT
Vaadin (based on GWT)
Sencha Touch, you'd have to be familiar with JavaScript though
You can also use the tools such as WYSIWYG (i.e. What You See IS What You Get).
Where without knowledge of ui you can still design ui.

JavaScript/Java GWT with Rails

I'm pretty new to web development, so I had some basic questions to get me pointed in the right direction.
For the last week I've been learning the rails framework, and from what I understand, this framework is great for building a website, but you still need javascript to build nice front-end interface/apps that run in the browser. Is this understanding correct? If not, why does javascript appear to be so essential to almost al websites? In other words, what can you do with js?
Also, I was wondering if it is necessary for me to learn javascript now that there are tools like GWT that compile Java into js. I ask because, I am proficient in Java but have no knowledge when it comes to javascript. How far can GWT take me before I need to learn javascript, or do I have to learn javascript at all?
If someone could point me int he right direction by answering these questions, I'd be very grateful.
Thanks
GWT compiles Java to JavaScript, but you still will need to learn about web development.
I have seen many projects going wrong with GWT because people just started writing Java code and did not care about the underlying platform (the browser) at all.
If you don`t want to care about the browser use some plugin technology (if you are an app inside a controlled environment), otherwise first learn about how to build apps with HTML + JS + CSS.
Eventually you will discover that GWT is a great toolkit for writing fast JavaScript apps in Java, that packs many best practices for building web apps inside the toolkit. It has good abstractions, but every abstractions leaks so you will need to have good knowledge of the browser. You will save on things like keeping away from the bad parts of JavaScript.
I'm working with GWT now, and I haven't had to use Javascript at all yet. I'd say for most websites, GWT should be fine.

Modern HTML/CSS/JS layout together with a Java backend

Introduction
I am basically coming from two sides of the development teams. I started building web applications using PHP. This way, I had to implement everything by hand. Forms, graphical elements, how everything is tied together (i.e. what happens when you click a button).
On the other hand, some time ago I entered the Java Web world, namely JSF. Which is in my opinion a nice way to build a "serious" applications. (why I think so, read below)
Problem
I would like to build a web app that is made of a nice and useable frontend that is designed after my specifications (basically doing the HTML and graphical layout as a horizontal prototype first - as far as possible -, then make a complete webapp out of it). But on the other hand I would like to do all the business logic in Java because of its many nice frameworks out there - Hibernate, Morphia, Lombok, Dozer, just to name a few I met and fell in love with.
I could build the frontend with JSF myself but I still think, that I'm too limited because I have to use the built-in components that can only be customized to a certain amount. What if I want to use my own design patterns and UI elements and behavior but still want them to work together with a Java "backend"?
What would be the "best" choice of tools to achieve my goal? Choose a different web framework like Wicket or similar?
My idea: Build a web application in Java that understands the good old GET commands and translates it to the Java methods. Sort of a RESTful service - although I'm not a great fan of making everything RESTful in the frontend - unless you tell me, that's fine and reliable.
Have you considered / looked at Google Web Toolkit for what you're trying to craft?
GWT is Java behind the scenes yet still can get you where you want to go, if I understand what you're asking.
Just an update:
If GWT isn't your thing, take a look at the Groovy / Grails route.
Just some elaboration here based on a comment...
With Groovy/Grails you don't actually have to merge your front and back end. I have seen that done, but its not necessarily always 100% required.
For example, you could create a web app in Grails where your AJAX functions could be formed and stored with the UI code being delivered out to the client for Great-UI-Justice. For added fun, you can even instruct Grails to include a JS framework such as jQuery to help you out with the UI.
Now on the back end, you should be able to take your Java back end and apply it directly with little to no change. However, I would recommend looking into adjusting anything you've done so far to take advantage of the Grails methodology.
There are many JSF libraries like ICEfaces,
RICHfaces etc, that make use of things like AJAX, etc.
In my personal opinion it's always a good idea to have a RESTful API and treat your web page just like any other client ;)

Wicket/Java UI framework Development

I am quite used to creating user interfaces with HTML/CSS/JS. However, I am working on a JAVA application that utilizes Wicket.
Can anyone point to me anything that shows how to create a ui with Wicket, from a stand point such as mine? If that makes sense. I have been trying to understand how I am going to develop the UI after reading many articles and meeting with our developers. I am just not wrapping my head around how to do it.
Also, from what I know, does it make sense to actually use Wicket when you have a ui designer and developer on staff who can create an MVC UI from scratch?
Please, if this doesn't make sense I hope you feel compelled to ask questions to pull whatever info you need and I am not saying. I am desperately trying to figure a.) does wicket make sense still, b.)how in the heck do I build a UI using it!
I think it can't get better than the examples in wicketstuff. You can just parse through the forminput sample. The sourcecode button is on right top.
There is indeed a small curve related to getting started with wicket as it changes the complete direction of thinking towards web GUI.
Basically, the idea of wicket is to have HTML template pages with some wicket markup placeholders that will be filled by the parallel java class.
The best way is to start looking at wicket tutorials on the official Wicket website. Then there is wicketstuff, which also has a very comprehensive collection as mentioned by Suraj Chandran. Most examples show you both Java and the associated HTML markup.
Even if you are not a Java developer it would be beneficial for you to understand how different Wicket markup tags get interpreted and how a Wicket-based application is built from several HTML pages, borders, panels and other Wicket-related components.
Wicket is very good for separating Java code from HTML (much better than frameworks that use JSP, PHP, and other technologies that mix code with HTML). Because there is no Java source code in the HTML pages it makes it easier for designers to work independently of the developers. Also HTML files can be edited in HTML editor programs like Dreamweaver directly.
If you are a Dreamweaver user and are familiar with Template and Library functions, then in the Wicket world you will find very similar concepts. Dreamweaver Template = Wicket Border, Dreamweaver Library Item = Wicket Panel, for example.

HTML Site Inside Java Portlets

I'm a complete noob when it comes to portlet development. I have a task which is to take a fairly small static html site and incorporate it into a portal/portlet environment.
My first thought is to develop one portlet that contains the entire html site within it.
Is this just a terrible idea?
If not, then I know I could make a simple portlet with an iframe to pull in the html for the site, but is there some other way to make a portlet that is a full functional little website?
Any help is greatly appreciated.
That's a pretty vague question, but I don't see why ou can't do what you're trying to do.
The Portlet API is pretty unpleasant, though, and makes the servlet API look fluffy and joyous. I suggest using Spring's Portlet MVC support to make it a bit less painful.
I dont think that you can and want "put" a whole website into a portlet because of the limitations of the api. Even if the website is servlet based that seems not to be a good idea.
From a user perspective you should perhaps focus on your widget idea. Think about a smaller subset that encapsules the functionality of the website that should be embedded or write an aggregator for the information of the site.
Think about why the website should be integrated and which information of the site are the most important ones. Perhaps there are any other information exchange interfaces like rss or atom feeds that you can use.
Another solution would be to use an existing cms-like portlet that can be "filled" with content. Here are some examples: http://www.jboss.org/portletswap/portlets_collab.html

Categories