Friday, November 21, 2008

Stack on Wicket

Premise:
The purpose of this entry is to explain my experiences on creating my very first wicket web application written in Java. Wicket is a web framework written in Java and its sole purpose is to create web applications. More information regarding wicket and the tools I used to deploy my application can be found below:

Apache's Wicket Framework WICKET
Tools and dependencies:
JETTY
SL4J

Stack-wicket:
My very first wicket application is very similar to my earlier blog entries about stack. This application proved to be a good starting point to get to know Wicket's framework. I started out by creating a Wicket Form, and made the subsequent labels, an input field and submit buttons (push, pop, and clear), and results table to layout my application. After successfully starting the Jetty server and running the application through the browser, then my next step was to add functionality to the buttons I had previously created. Before adding the functions to the buttons, I created a session class to handle multiple user's by keeping a copy of the user's stack and variables (input field) in a session. Next comes the easy part, adding functionality to the buttons by creating anonymous ("on-the-fly") classes. I never knew there was a name for on-the-fly classes that really comes in handle when you need to just tweak a few override methods (onSubmit()) without having to create a new subclass.
Issues:
Upon creating this application, I ran into a few bumps and annoyances. One thing that bothered me the most was configuring my environment to support wicket and its subsequent dependencies (.classpath, build.xml). A lot of these issues were minor, but it's quite detrimental in a sophisticated application like this. Other than configuration issues, I also had ones that involved coding. Many of the coding issues were reported back from running "ant -f verify.build.xml," one of which involved serializing the Stack class. This, along with a few other modifications were made to the Stack class. After trickling down and resolving all errors from FindBugs and PMD (they're best buddies), I was able to pass verify and run the application successfully.
Download Distribution:
The copy of my distribution of stack-wicket can be found here.

Conclusion:
Overall the application was quite self-explanatory. You create a stack and you have only a few options to operate a stack (push, pop or clear). The knowledge I gained from this experience was basically figuring out a good work-flow for creating web applications using Wicket. I now have a better understanding, along with a process of thinking when creating these kinds of applications. It's something to get used to, and the concept can be easily assimilated into other similar web frameworks.

No comments: