JSF is based on Inversion of Control. In the IoC paradigm, the Model (backing bean) does not "go out and get" data from the View (web page), the JSF Controller (FacesServlet) reads the submitted data and posts it to the backing bean automatically without any JSF-specific logic required.
In fact, my #1 rule for JSF is this:
If you are coding JSF-specific Java code, you are probably doing it wrong.
An IDE is no substitute for an Intelligent Developer.
Joined: Mar 02, 2013
Thanks for your prompt response.
100% i will agree with your comment, the jsf framework populate the data into backed bean automatically, but it will happens after the validation phase, but in my case i am attaching ajax support, so before performing the validations, i can retrieve the data from the view with the ActionEvent, as shown in the code above.
i was succeeded in the browser IE, but in mozilla / Chrome i am having problem, in these 2 browsers only i am getting null value.
And i will explain my exact requirement also, of course in jsf after page submission all the attached validators will fire, but for me on tabbing out of each field in the form, the corresponding validator needs to be fired, so as shown in above i am attaching one listener to text fields, and i getting the value by using getSubmittedValue(), i am checking this value is null or not, if it is not null then i am calling validator manually, So my case in IE value is coming, so i can call validator manually, but in mozilla/chrome value is not coming, so my validator is not getting fired.
JSF processes AJAX in exactly the same way it processes ordinary command actions. The only difference is that an ordinary commandlink/commandbutton submits all controls on its associated form and updates the entire page, but AJAX can be set to submit only parts of the form and update only parts of the page.
Listeners are not asynchronous event handlers, nor do they bypass parts of the JSF lifecycle. JSF listeners are simply methods that get invoked as part of a submit request when conditions warrant (for example, when a form control's value has been changed).
As I said before, JSF is designed to make simple things simple. If you don't want validation, you have to simply not set validation in the View Definition and validate manually in the action method. Or make the validation conditional on an EL expression. In any event, a JSF form will NEVER return null, because NULL is not a text value and JSF is communicating via a text-based protocol (HTML). Instead of NULL, you'd have an empty string being injected into your bean.
Joined: Mar 02, 2013
I am not saying the listener will by pass the jsf life cycle, i wanted to know whether i can capture the value entered by the user from the the view or not, i wanted to capture it into a variable, not into backed bean, yes any how my jsf frame work will do that(populate the data into backed bean), i wanted to capture that value into a variable by using the listeners before jsf populating the data into backed bean, Kindly tell me is it possible?