Monday, March 28, 2011

JSF Validations, Dependency injection etc

For last few months I am getting to customize quite a few JSF features. This is JSF 1.1 and I some times I feel some level of dependency injection would have made my life easy. I shall disuss couple of examples below.
As in struts validations kicks in whenever you submit a form. But there are many instances where I need to submit form (bcause I need all values in screen) but don't perform validatiions for one action on a screen and for other action I need to perform validations. Basically I like to skip validations if there is a reauest parameter named SkipValidation present or target method name starts with 'load'.
In struts I achieved this by overriding processValidation method and adding a condition so that validation is skipped if method name follows certain pattern. I thought I can do a simillar thing in jsf. Wanted to modify ValidationPhase such that validation is skipped in certain cases.
But the class that implements validations is hardcoded or instanciated in LifecycleImpl class. To create a custom life cycle, you need to create Impl class configure it web.xml, create ContextListener to populate FacesConfig and bind all faces listeners to new impl class. And I add no to minimal code in tbhese classes. If I could inject the class that implements validation phase using some config file via dependency injection, I could have avoided lot of coding.
I will discuss another instancd onvolving StateManager in my next post.

Tuesday, March 22, 2011

My first Android app...

Last night I successfully implemented my first Android application. I wrote app which will place a call to my wife's mobile. I named it 'Call My Wife' :). Now I can call my wife with one tap. Though it just little more than Hello World sample, its fun and exiting to get something end to end done and also to see some thing I developed running on my mobile.


Its a small first step and I hope I will be able publish my own application in Android market soon. I thinking of building some application using my expierence in Indian Language Technology.