03.20.08
Apache Wicket : The greatest Java Web Framework Ever!
There has been a lot of confusion in Java Web world, as to what “will” work eventually with advent of so many Web Frameworks; each reinventing the wheel in some way or the other; trying to solve one problem ignoring others altogether.
I have accumulated fair amount of experience working with following frameworks ( UI / Web ):
- Struts 1.x ( Old, Stupid monolithic giant, which unfortunately many are still using).
- JSF ( Component based framework; customization of components is a nightmare … Configuration files crap still exists)
- Tapestry ( Great component based framework, best apart from Wicket )
- Spring MVC -> Customizable, perhaps too much flexibility;
- Struts 2.x -> Decent improvements over Struts 1.x but still the same with configuration files etc.
- GWT ( Google Web Toolkit )–> great, but requires a separate compiler;
- DWR ( Direct Web Remoting ) –> decent for AJAX. haven’t had a chance to explore it in entirety.
Out of all the above, I think Apache Wicket Framework stands out as the PROUD WINNER HANDS DOWN ( YeaH yEAH all you Tapestry people out there, try APACHE WICKET! ). Apache Wicket reminds me of Swing Model of programming; the best part is that while programming in Web Paradigm; i dont feel that i am in Web kind of programming mode. For example if i am coding things in struts or any other so called MVC framework, i would be doing JSP and writing configuration files and god knows what not.
Bottom line : WHY? WHY? WHY? WHY? what is the need for all of this ?
Flaws in frameworks which call themselves “MVC”
The truth is that i knew about this flaw for a long time ( Recently someone reminded me of this flaw over again, hence the rush to type in ) Basically, ( for those of you who are not familiar with MVC, refer to : MVC ) in almost all frameworks you’d find JSP which is a view, a controller servlet which handles and delegates to other classes some responsibility and controls the flow of application, the model which could be a Plain Old Java Object (POJO). Now the problem with JSP is that it simply (in almost all cases) is never a pure view, why? well because it has something called EL (expression language) which can provide for conditional constructs ( like for example
Here comes Apache Wicket!
To understand how Apache wicket solves above annoying issues, i think it’d be appropriate to go through with a simple application flow:
- you only needed 1 xml file (that is web.xml, d-oh!)
- You do what you “should” be doing as a java developer in the first place; write Java classes, each Java class (for example a Page type ) can have components, you add components the “same” way (almost) as you were used to adding in Swing framework back in old days (for me at least, haven’t worked in Swing for while). Your response or page navigation is based on classes and Classes Only! ( for example you have a button’s onSubmit( ) method in which you mention setResponsePage(NextClass.class, params); // where params is parameters you want to pass in ( And No they are not from request object! you would not need request object here … which is why i love this framework (i know … feels a little weird)).
- You html files DONOT contain logic of any sort, they are pure HTML files (well almost).
I have to try Flex and OpenLaslo yet, but Wicket is HOT!
Note : I haven’t been through the typical sequence of what happens when a request comes in, how Wicket handles it; I’ll cover those things in later posts …
For now try this site : Wicket Stuff
Regards
Vyas, Anirudh