Hello mates,

I just want to note that one of the JSF good things is to allow developers
to bind the components directly with model without
having to directly hack the request parameters, and model methods should be
called in the action of the components (INVOKE_APPLICATION phase).

JSF is a component-oriented framework. JSF application developer should not
care about (ServletRequest) as binding is done automatically by the
framework.
So if one finds (him/her)self having to talk directly with (ServletRequest)
inside the JSF application then (s)he should do some refactoring to
eliminate these direct calls.

Thank you mates.

On Sat, Nov 29, 2008 at 3:09 PM, santosh chouhan <
[EMAIL PROTECTED]> wrote:

> Thank you very much Justinas.
>
> Santosh Chouhan
>
>
> On Sat, Nov 29, 2008 at 6:20 PM, Justinas <[EMAIL PROTECTED]> wrote:
>
>> santosh chouhan wrote:
>>
>>> Hello Justinas,
>>> Which one is called  first , is there any case possible where Ui
>>> component can directly connect to model bean . please any one give the
>>> exactly scenario of beans when they come in action.
>>>
>> First called is backingbean. Then bb does some logic, and calls model.
>> To call model method directly from UI component is bad, because, during
>> page rendering very often bindings are called more than once. You could see
>> that in effect when you put system.out.println("sometext") in BB setter or
>> getter method!
>> Backing beans are helpers, temp value storage for UI component or group of
>> them. They take data from Model beans.
>>
>> Usually I put BB in request scope, and in constructor I initialize it
>> using calls to Model classes according to request parameters. In that way,
>> model beans are called once per request and backing bean hold values as long
>> as it takes to render page.
>>
>>>  From which beans i get my form attribute ,  please make me clear all
>>> step
>>>
>> h:dataTable value="#{myBB.dataModel}"
>>
>> BB:
>> private DataModel dataModel;
>> constructor:
>>   this.dataModel = new
>> ListDataModel(MyModel.getItemList(Contexts.getRequestParam('parent_id'));
>>
>> where Contexts.getRequestParam is helper function to extract post/get
>> parameter from HttpRequest.
>> MyModel.getItemList() - static method, returning List of items. It
>> encapsulates required SQL and so on.)
>>
>> hope that clears things up!
>>
>> Justinas
>>
>
>


-- 
Hazem Ahmed Saleh Ahmed

Author of (The Definitive Guide to Apache MyFaces and Facelets):
http://www.amazon.com/Definitive-Guide-Apache-MyFaces-Facelets/dp/1590597370

Web blog: http://www.jroller.com/page/HazemBlog

[Web 2.0] Google Maps Integration with JSF:
http://code.google.com/p/gmaps4jsf/
http://www.theserverside.com/news/thread.tss?thread_id=51250

Reply via email to