Last week I had a need to build a web application prototype for work, and a real user who I could discuss requirements with. Basically, she needed a relational database with a web front end. Of course, I was thinking AJAX, and built the HTML mockup of the design with those types of interactions in mind.
I pretty much knew I was going to use GWT to implement it…I’ve been wanting to dig in to GWT, and here was a perfect opportunity. Also, in a comment from a prior post, I learned that a new beta of my favorite IDE, IntelliJ IDEA, had just built in a GWT integration. Freakin’ sweet!
So off I went. I built a single GWT module with a form that reacted dynamically to events occuring in several controls. The cool thing was that I had my page design in HTML, and I was able to just add an id to certain table cells with a name that I could refer to within my GWT code. This enabled me to just pick my spot, build my control in Java using the GWT API, and add it to the page. Very nice.
Or so I thought. This was the first noticeable problem I encountered. I had the application running very smoothly in the browser tool that is built into the GWT toolkit, but it did not work in IE, Flock, or FireFox. Quite honestly, it didn’t matter too much for me since I was just building a proof of concept. If you’re part of the GWT crew, ping me and I can look into it further so as to isolate the problem.
The next big problem I had with it is that there was no way that I could see to set the value of a list box to something other than what it displayed. So for example, if I had a list box that contained different products for the user to choose from, I might want the actual value of that list box to be the primary key id from the database for that product. Without the ability to do this, my application loses data integrity. Maybe two products have the same name! What should I do then?
This next one really bugged me quite a bit: I couldn’t figure out how to build multi-page applications within a single GWT module. I know this was a limitation of the IDEA integration, and they’ve filed a bug about it. Again, I didn’t try too hard to figure this out due to the time constraints I had to complete the prototype.
Also, I could not figure out how to obtain multiple values from a multi-select list box. Granted, I didn’t tinker with the API regarding this point, but it certainly wasn’t obvious to me that it was possible. I would have expected a getSelectedValues() method that returned a List to be available as part of the ListBox class.
Finally, GWT does not currently support the use of java.util.Calendar. Instead, you have to use the deprecated java.util.Date class and its deprecated methods. Not a really big deal, except that it makes me feel dirty. I hope they add support soon so I can fix that code!
If you’ve worked with GWT, what are your impressions?
Blogged with Flock