Thursday, July 29, 2010

Google Web Toolkit (GWT) CRUD - SmartGWT





I found this extensive GWT widget developed and licensed under GNU. From the all the GWT frameworks I have seen, this is the best one so far. It has over 260 showcase features and it is open source!. One of the biggest strength of this framework is the support for data integration/binding. GWT is an amazing tool. However, it doesn't have much of built-in framework for form validation/binding. Writing the code for data binding/validation in GWT can consume a lot of time. SmartGWT has amazing API functions to deal these obstacles with just a couple lines of code!

Look at the show case below:
http://www.smartclient.com/smartgwt/showcase/#add_grid_form_category

Pay close attention to Grid-Form-Binding. Writing GWT CRUD screen with SmartGWT sounds like a piece of cake!

For more information:
- Google code: http://code.google.com/p/smartgwt/
- Showcase: http://www.smartclient.com/smartgwt/showcase/


Wednesday, April 7, 2010

Spring MVC Attachment Upload/Download Handler





I implemented an attachment upload/download handler using Spring MVC. Uploading was just a piece of cake because all I had to was wiring the multipart resolver into the configuration and have a bean injected to it. Spring documentation was all I needed.

However, downloading was more tricky. I have to get response's output stream, set mime type and write the byte arrays to it. I found out this great mime type list for 2007 office. Even after I set the mime types for the response, .docx was saying that the file was corrupt. Once I click "Yes" on the recovery, it comes back fine but I am not sure why it is getting corrupted as all the other attachments come back just perfect. If anyone has any insights on this issue, please let me know.

Office 2007 Mime Types
.docm, application/vnd.ms-word.document.macroEnabled.12
.docx, application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm, application/vnd.ms-word.template.macroEnabled.12
.dotx, application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm, application/vnd.ms-powerpoint.template.macroEnabled.12
.potx, application/vnd.openxmlformats-officedocument.presentationml.template
.ppam, application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm, application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx, application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm, application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx, application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam, application/vnd.ms-excel.addin.macroEnabled.12
.xlsb, application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm, application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm, application/vnd.ms-excel.template.macroEnabled.12
.xltx, application/vnd.openxmlformats-officedocument.spreadsheetml.template


Wednesday, January 27, 2010

DisplayTag feature to expose row numbers

I was working on Spring MVC and DisplayTag to structure the table. I had a list of objects and needed to refer the index of an item because I had to use <spring:bind>

I discovered a cool DisplayTag feature that exposes the row number of an item. Here is an example:

<display:table name="ticketList" id="ticket"> 
<display:column title="Row Number">
${ticket_rowNum}
</display:column>
</display:table>



You are basically appending "_rowNum" to the variable to get the row number.