June 14, 2009

Wicket, Java web development makes sense again

I've been meaning to write about my experiences with Apache Wicket after having it used extensively for my latest project.

So for this project we needed to write a web app with as few screens as possible, preferably a single document interface, keeping it very simple for the end user. The main target audience was the accountancy department, so it had to be keyboard driven. On top of that coming from an MS Access app, the users were expecting autocompletion and immediate validation-feedback.

Given these facts as a Java developer I was immediately thinking: Swing or Flex. No JavaFX still wasn't released at the time we started prototyping.
Unfortunately our client was unwilling to start with a new client technology involving browser plugins and the possible sideeffects of this on the already overworked helpdesk.

So on we went looking for the best matching web technology...
  • SpringMVC - the current standard web technology at that client. Although not a terrible web framework, the single document interface requirement, doesn't quite fit the SpringMVC Action based model. Secondly there aren't any AJAX components, unless you'd integrate third party JS libraries, something we wanted to avoid as much as possible.
  • JSF - being the new Java web standard for a while now has gained quite some traction on the job market. Being component based was one of the main reasons why we considered JSF, but with all the complexities that JSF development brings and all extra frameworks built around it like Facelets, RichFaces, Seam and even Spring to getting JSF to be productive and developer friendly didn't reassured my team we could deliver an approriate solution in time. Unfortunately we didn't have experience with JSF and from the experiences on the web we were quite sceptical.
  • GWT - Having used GWT for a proof of concept at a past client I was well aware of it's capabilities, but also it's weaknesses. GWT has undergone some major changes since it was released a few years ago. With that a lot of component libraries built around it have come and gone as well. Although in the early days the standard GWT components were pretty basic, the recent 1.6 release shows a big improvement in this area. So today it might have been a valid solution for our problem, but at the time of the project we were still facing the questionable components problem. Because GWT also involves a different development strategy and still has a poor Maven integration (also a standard at the client) we chose to go with option nr 4.
  • Wicket - a component based web framework that has been around since 2004 and since long has most of the features JSF 2.0 will maybe have by the end of this year. Given the history of the project, the many positive experiences mentioned in blogs and a team with 2 experienced Swing developers made us decide to go with Wicket.
So what makes Wicket so great.
  1. Component based -  a lot of the UI in our app could be disected into reusable components, really made our life easier in the long run. 
  2. Swing like - event listener and form composition approach used by Wicket is very similar to how you'd compose your UI in Swing. It's not very surprising given the founders of Wicket were Swing developers in a past life. So was 60% of our team.
  3.  XHTML templates - No messing around with JSPs and taglibs. Just plain old annotated HTML templates to describe your layout and components and then accompanying Java classes to define the behavior of your UI. This allowed for some very flexible components, processing and user-feedback.
  4. Authentication / Authorization - support for plugging in your own authentication and authorization strategy at the component construction and rendering level. This allowed us to have @annotation-based declarative role-based authorization in our UIs.
  5. AJAX framework - AJAX has been built into the core of Wicket, supporting AJAX events and behaviors and tight integration in the rendering lifecycle allowing the developer to think about the real business issue at hand, Wicket takes care of the rest.
  6. Form Validation - form and component level validation is built into the core of Wicket and available as part of the lifecycle, even integrated with AJAX behaviors and partial rendering so you don't have to worry about that as a developer.
  7. Binding - Forms and datatables have strong support for binding to your POJO's or models, based on reflection. You can even go several object hierarchies deep. This also works on the datatable with out of the box sorting and filtering based on such nested paths.
  8. Statefull - the pages and components you define contain their state as member variables, so you don't have to mess with the HTTPSession, Wicket takes care of this as well.
Having developed for the web in JSP scriptlets/Servlets/Taglibs, Struts and SpringMVC always seemed like too much effort for what you get in return. It's also very confusing what is to happen next, every time I switch between one of those technologies I have to grab the manual again to understand the lifecycle. In Wicket it's straightforward, you instanciate your page class and add components to it, who have listeners and behaviors that you implement. These callback methods get called on the subsequent events... plain and simple!

Working with Wicket has been a pleasure, we started off with just building our prototype screens with XHTML and a little bit of Wicket magic to bring them to life. We soon realized that we could continue to build upon that prototype without having to rewrite all our screens in JSPs like we would have in the other technologies. Our client was very pleased with the non-static prototype and the fact that we didn't had to redo the screens for the real app, this is usually where it goes wrong when developers have to work with a webdesigner for the UI.
We were able to advance so quickly and managed to build some reusable components that can be packaged as JARs to be included in new applications, giving them a head-start.
For a small team without knowledge of the framework it took us just a few days to grasp the basic concepts and worked our way through the rest while working out the different parts of the application, it's just so straightforward and there is a great sample

Although Wicket is an excellent approach to web development in Java, there are a few things you should know...
As you are building a lot of view-logic in your Java code, with a lot of listeners and inner classes for callbacks etc, you really need to think 'components'.
All too often you start the next screen by copy-pasting from the last one. When if you think about it you realize it has about 50% of the same logic, which you should extract from both screens into an abstract component. If you fail to do this you get a messy codebase with a lot of code duplication and each developer tends to have it's own style so it can get messy if you don't work together and refactor in time.
But if you do this like we did, we ended up with a few handy base classes like AbstractFormTablePanel that we needed to give a few parameters and in about 20 lines of code we had a new master-detail CRUD screen for a new entity, with complete sorting, filtering and validation.

Another weak point is that although Wicket has AJAX built-in the core framework that handles JavaScript events and partial page refreshes perfectly a lot of the AJAX components (datepicker, tree, ...) are third party (wicket-extensions project for example) and they are not of the same quality as the core framework. We noticed some JavaScript compatibility issues with some browsers, mostely IE as you would expect. Unfortunately that was our target browser, as is the case in most large organizations.This was also because the Wicket team focussed more on getting Wicket 1.4 out of the door instead of fixing bugs in the old stable branch. Later we noticed that a 1.3.6 version had been silently released where some of our issues were addressed. At least there is still an active community supporting Wicket after so many years and that for a relatively small userbase. On a sidenote Wicket is still slowly gaining job-marketshare:

*note: GWT is 'off the charts' with about 175% growth... worth another look!

All in all I would definately choose Wicket again, it just makes sense and I've never had more fun developing for the web in Java!

35 comments:

  1. Any chance of publishing the code for AbstractFormTablePanel?

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. I'm currently working for a different client so I don't have access to the actual source anymore.
    However it's fairly straightforward to write your own. Start by creating a few pages and seek for recurring parts, either visually or by behavior. Then extract those in the abstract class, repeat from step 1 ;-)
    I'm not sure if the base class we wrote would fit every application, it's not meant to be flexible. Just flexible enough to support our 3 different single page designs.
    Let me know if you require any further assistance.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. A debt of gratitude is in order for giving late reports with respect to the worry, I anticipate read more. Webdesign

    ReplyDelete
  5. Hello! I just wish to give an enormous thumbs up for the nice info you've got right here on this post. I will probably be coming back to your weblog for more soon! Webdesign

    ReplyDelete
  6. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Webdesign

    ReplyDelete
  7. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Webdesign

    ReplyDelete
  8. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Webdesign

    ReplyDelete
  9. Choosing to begin a vocation in Web Design is the initial segment. The focal points are engaging. Webdesign

    ReplyDelete
  10. Yes i am totally agreed with article and i want to say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! best software development company

    ReplyDelete
  11. Wonderful post. I simply stumbled upon your weblog and wanted to mention that I have
    truly loved surfing around your blog posts.
    You can find more information regarding software services click herebest software solution in hyderabadREPLYDELETE

    ReplyDelete
  12. Excellent read, Positive site, where did u come up with the information on this posting? I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work 에볼루션카지노

    ReplyDelete
  13. Youre so cool! I dont suppose Ive read anything such as this prior to. So nice to uncover somebody with many original ideas on this subject. realy thanks for starting this up. this fabulous website can be something that is required on the internet, somebody with a little originality. valuable problem for bringing something totally new on the web 토토커뮤니티

    ReplyDelete
  14. may additionally i in reality say what a relief to uncover someone that without a doubt is aware of what they will be speakme about online. You in reality recognize the way to bring a hassle to mild and make it crucial. Extra human beings have to test this out and apprehend this issue of the story. I used to be amazed that you are not extra popular due to the fact you simply have the gift. Subsequent time i examine a blog, i am hoping that it does no longer disappoint me simply as a bargain as this one. I suggest, i are aware of it modified into my choice to read, but i in truth believed you will possibly have some aspect exciting to talk approximately. All i concentrate is a set of crying about a few factor you can repair if you had been now not too busy seeking interest. You've got made a few superb points there. I checked at the internet to find out greater about the hassle and determined most people will go along with your perspectives in this website. 먹튀검증

    ReplyDelete
  15. usually i do no longer examine article on blogs, however i desire to say that this write-up very forced me to try to accomplish that! Your writing fashion has been amazed me. Thank you, quite splendid article. woah! I’m genuinely gambling the template/challenge of this internet website. It’s clean, but powerful. Masses of times it’s difficult to get that “high-quality stability” amongst top notch usability and visible appearance. I've to say you’ve completed a remarkable undertaking with this. Additionally, the blog hundreds notable short for me on opera. Extraordinary blog! I truely want to present a massive thumbs up for your remarkable information you’ve were given proper right here on this put up. I’ll be coming lower back all over again for your website for hundreds greater speedy. Took me time to take a look at all the remarks, but i virtually loved the article. It proved to be very beneficial to me and i'm sure to all the commenters here! It’s generally great at the same time as you can not only be knowledgeable, however additionally entertained . I experience quite joyful to have seen your website internet web page and anticipate one of these massive range of all of the more engaging instances perusing right here. An lousy lot preferred another time for each one of the factors of interest. Thanks for giving me useful statistics. Please maintain posting accurate information in the future i will go to you regularly. Thanks . 헤이먹튀

    ReplyDelete
  16. first-rate placed up. I was checking constantly this weblog and i'm impressed! Rather helpful statistics in particular the final component i take care \enerate applicable visitors which key word should i pick out, technique how to determine any key phrases effectiveness are you able to advocate me? My internet site is ready consultancy for commercial agency. Thanks . Some absolutely incredible paintings on behalf of the owner of this internet internet website online , perfectly incredible articles . I recently got here across your weblog and have been analyzing along. I concept i would depart my first comment. I do not know what to say besides that i have enjoyed studying. Best weblog. I can hold travelling this weblog very frequently. Virtually admiring your paintings and thinking the way you controlled this weblog so well. It’s so super that i can not find the money for to no longer go through this valuable information whenever i surf the net! I am happy to find out this submit very useful for me, as it incorporates lot of records. I constantly favor to study the amazing and satisfied i found this factor in you publish. Thanks 먹튀검증

    ReplyDelete
  17. terrific look at, i simply exceeded this onto a colleague who became performing some have a take a look at on that. And he truely offered me lunch due to the fact i found it for him smile so allow me rephrase that: which can be in reality outstanding. Most of the people of tiny specs are unique owning lot of song record competence. I am just searching out to it over again quite masses. I found that is an informative and thrilling post so i assume so it's far very useful and informed. I would like to thanks for the efforts you have got got made in writing this article. I'm definitely getting a charge out of inspecting your flawlessly framed articles. In all likelihood you spend a considerable measure of exertion and time in your blog. I've bookmarked it and i'm anticipating investigating new articles. Hold doing astounding. i really like your positioned up. It's miles very informative thank you masses. In case you want cloth building . Thank you for giving me beneficial data. Please hold posting genuine data inside the destiny . Nice to be visiting your blog over again, it's been months for me. Well this article that ive been waited for consequently prolonged. I need this text to finish my task in the university, and it has identical subject matter together along with your article. Thanks, best proportion. I wanted to thanks for this to your liking ensnare!! I in particular enjoying all tiny little little bit of it i have you ever ever ever bookmarked to test out introduced belongings you pronounce. The blog and records is exceptional and informative as nicely . Superb .. Splendid .. I’ll bookmark your weblog and take the feeds also…i’m happy to locate such a lot of beneficial records here inside the post, we need exercise consultation more techniques on this regard, thank you for sharing. I need to say best that its amazing! The blog is informational and constantly produce notable things. Top notch article, it is in particular beneficial! I quietly began on this, and i'm turning into greater familiar with it better! Delights, preserve doing extra and additional brilliant 먹튀검증

    ReplyDelete
  18. You are doing amazing work keep it up, and thank you so much for sharing this important and useful information with us and all the best for your upcoming post. This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging Looking to reading your next post. Great website and thanks for offering good quality info. nice thanks for share great post here . Thank you so much for ding the impressive job here, everyone will surely like your post. I really enjoy reading and also appreciate your work. Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post. Admiring the time and effort you put into your blog and detailed information you offer!.. 먹튀검증커뮤니티

    ReplyDelete
  19. youre so cool! I dont assume ive read anything which incorporates this previous to. So satisfactory to discover each person with many unique thoughts in this problem. Realy thank you for beginning this up. This excellent website can be a few aspect that is required on the net, somebody with a touch originality. Valuable trouble for bringing some thing actually new at the net . Best with your permission permit me to capture your feed to maintain up to date with coming near near post. Thanks a million and please preserve up the pleasing paintings 파워에이스

    ReplyDelete
  20. you've got got carried out a terrific interest on this newsletter. It’s very readable and pretty sensible. You have even controlled to make it comprehensible and clean to examine. You've got were given some actual writing information. Thank you. I'm for the number one time right here. I discovered this board and i in finding it actually beneficial & it helped me out a lot. I hope to provide some aspect decrease lower back and assist others which include you helped me. With out issue, the factor is virtually the extraordinary situation matter in this registry related hassle. I fit in together with your conclusions and could eagerly stay up for your subsequent updates. 해피머니상

    ReplyDelete
  21. thanks for posting this records. I actually need to assist you to take into account that i actually check out your website and that i discover it very interesting and informative. I can't wait to look at masses of your posts. This is an super put up. I like this subject remember. This internet site has masses of advantage. I found numerous charming things from this net website online. It helps me in numerous ways. Thanks for posting this once more. Your article were given me considering some thing. Who can we touch if we want anesthesia quickly? I have heard there are some mobile offerings on line, and now i understand which of these offerings is nice at their undertaking. I am satisfied my buddies instructed me about them. I surely inspired after study this due to a few superb paintings and instructive contemplations . I simply wanna particular profound gratitude for the writer and need you to enjoy all that life has to offer for coming!. Thank you for sharing best information with us. I sincerely like your post and all you proportion with us is uptodate and pretty informative, i would love to bookmark the page so i can come right here again to examine you, as you have performed a outstanding procedure. Extraordinary submit i want to mention and thanks for the facts. Training is without a doubt a sticky assignment. But, is still a few of the fundamental topics of our time. I respect your put up and sit up straight for more. 하이머니

    ReplyDelete
  22. i virtually couldn’t leave your website before suggesting that i definitely loved the same old facts an person offer for your visitors? Is gonna be back often in order to look into new posts. I found your weblog thru google while looking for first aid for a coronary heart assault and your submit looks very interesting for me. That is my first visit for your blog! We're a team of volunteers and beginning a brand new project in a network in the same niche. Superb submit but , i used to be trying to understand if you can write a litte more on this difficulty? I’d be very thankful if you may tricky a touch bit similarly. Bless you! 안전놀이터

    ReplyDelete
  23. thanks for posting this records. I actually need to assist you to take into account that i actually check out your website and that i discover it very interesting and informative. I can't wait to look at masses of your posts. This is an super put up. I like this subject remember. This internet site has masses of advantage. I found numerous charming things from this net website online. It helps me in numerous ways. Thanks for posting this once more. Your article were given me considering some thing. Who can we touch if we want anesthesia quickly? I have heard there are some mobile offerings on line, and now i understand which of these offerings is nice at their undertaking. I am satisfied my buddies instructed me about them. I surely inspired after study this due to a few superb paintings and instructive contemplations . I simply wanna particular profound gratitude for the writer and need you to enjoy all that life has to offer for coming!. Thank you for sharing best information with us. I sincerely like your post and all you proportion with us is uptodate and pretty informative, i would love to bookmark the page so i can come right here again to examine you, as you have performed a outstanding procedure. Extraordinary submit i want to mention and thanks for the facts. Training is without a doubt a sticky assignment. But, is still a few of the fundamental topics of our time. I respect your put up and sit up straight for more. 사다리사이트 안전놀이터추천

    ReplyDelete
  24. I like your post and all you share with us is up to date and quite informative, I would like to bookmark the page so I can come here again to read you, as you have done a wonderful job. I'm excited to find this website. I wanted to thank you for your time due to this fantastic read!! I definitely savored every little bit of it and I have you saved to fav to look at new stuff in your website. I'm truly enjoying the design and layout of your site. It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme? Outstanding work! There is certainly a great deal to learn about this issue. I like all the points you made. 토디즈

    ReplyDelete
  25. a totally splendid weblog post. We are surely thankful to your blog put up. You'll find quite a few techniques after touring your put up. I used to be exactly attempting to find. Thank you for such submit and please preserve it u . I simply couldn’t escape from your net website earlier than suggesting that i virtually preferred the typical facts an character provide to your guests? Is probable to be all over again robotically to observe fresh articles a very super weblog post. We're sincerely grateful to your blog put up. You may find a number of methods after travelling your post. I used to be exactly searching for. Thank you for such publish and please keep it 온카맨

    ReplyDelete
  26. i in my opinion use them my preferred minis for almost the entirety. From time to time i without a doubt draw wow gold online in your private home clearly because. They can be sooooo fashion no longer to mention proper! Incredible beat ! I would like to apprentice at the same time as you amend your website online, how am i able to subscribe for a blog website online? The account aided me a appropriate deal. I have been tiny bit acquainted of this your broadcast provided bright clear idea . I much like the valuable facts you offer to your articles. I'm capable of bookmark your blog and test once more right here frequently. I'm quite positive i’ll research plenty of latest stuff right right right here! Unique achievement for the following! 바카라

    ReplyDelete
  27. I would like to thnkx for the efforts you have put in writing this blog. I'm hoping the same high-grade blog post from you in the upcoming also. Actually your creative writing skills has encouraged me to get my own blog now. Really the blogging is spreading its wings fast. Your write up is a good example of it. I don't even know how I stopped up right here, but I believed this submit used to be good. I do not know who you're but certainly you're going to a famous blogger if you happen to aren't already. Cheers! very nice blog!! Man .. Excellent .. Wonderful .. I will bookmark your website and take the feeds also? I'm satisfied to search out numerous helpful information right here within the post, we want work out more techniques in this regard, thanks for sharing. . . . . . 토토사이트홍보

    ReplyDelete
  28. first-rate facts, precious and amazing layout, as percentage suitable stuff with suitable thoughts and thoughts, plenty of incredible statistics and inspiration, each of which i want, way to provide this type of useful facts here. I used to be genuinely surfing through the net looking for a few information and got here throughout your weblog. I'm impressed through the records which you have in this blog. It suggests how well you recognize this problem. Bookmarked this web web page, will come lower back for extra. Truly exceptional and exciting put up. I used to be searching out this kind of statistics and loved reading this one. Hold posting. Thank you for sharing. 먹튀검증

    ReplyDelete