myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "anshuman roy" <anshuman.roy....@gmail.com>
Subject Re: [Trinidad] using custom model with tr:table
Date Wed, 26 Mar 2008 07:01:29 GMT
Why have you put this

model = new Model()

inside the constructor? If you do eager loading then for each phase in the
jsf lifecycle it will get invoked so you would get too many unwanted issues.
Try using lazy loading instead and this would work.

regards,
Anshuman


On Thu, Mar 20, 2008 at 4:52 PM, Ravindra Adireddy <
adireddyravindra@gmail.com> wrote:

> Hi all,
>
>            I am using my custom model with trinidad table as shown below.
> I want to instantiate my custom model only once regardless of backing bean.
> Is it possible?
>
> *Model Class:*
>
> public MyModel extends CollectionModel {
>
>     // logic
> }
>
>
> *Backing Bean:*
>
> public MyBackingBean {
>
>         private MyModel  model;
>
>          public MyBackingBean() {
>              model = new Model(/*some collection */);
>          }
>
>           public MyModel  getModel() {
>                 return model;
>            }
>
> }
> *
> JSP page:*
>
> <tr:table value="#{myBean.model}" .....>
>
>
> *The backing bean is in request scope.*
>
> *
> Problem:*
>
> Since the backing bean is in request scope, for every request new instance
> of model is created. I don't want to create new instance of my custom model
> since i am storing some state in it. Is there any way to create only one
> instance of  custom model regardless of backing bean scope, like trinidad
> creates only one instance of SortableModel.
>
>
>
> --
> Thanks and Regards
> Ravindra Adireddy




-- 
regards,
Anshuman Roy

Mime
View raw message