En l'instant précis du 12/21/06 00:00, Behrang Saeedzadeh s'exprimait
dans toute sa noblesse:
>
> That would make the items remain in memory far longer than they are
> actually needed to be. I was hoping to avoid the session.
There is also the application scope, it has some usage for handling
application wide lists :) Also everything that is user specific and
stays longer than request scope has to go in session. So if
selectonemenu was to keep it's list of datas, that would be in session.
>
>> Btw, i see you are working in two steps action "init" -> show form ->
>> "action select". If you handle your list initialisation differently, you
>> can remove the 'init' step, which is typical to struts imho.
>
> Could you please explain a little more?
>From my experience is struts, it's quite common to have to direct user
to a .do link that will initialize lists before rendering. So you in
fact need to invoke a first struts action (something.do?dispatch=init).
What you were doing in your example is to provide a link that will call
an action that will 'init' your list before first rendering. That's bad
for 2 reasons.
1) you need an action to access your 'select' form.
2) Your list will empty when you rerender form (eg if you fail validation)

JSF has powerfull mecanism to initialize your beans. You can even
initialize some properties of your beans to values of EL expression and
link between managed beans. All this in your faces-config.xml.
All the init steps can then be done either in the bean code and you can
have your request scope bean preconfigured so it has access to session
or application wide managed beans. This is very interesting when you
need to use request scope bean but have to persist some informations
(like list of items). The request scope bean then acts as a facade.
>
> Yeah. I tried t:saveState. It worked great for me. Thanks for the tip :-)
>
Glad to hear you have a working solution :)
> Regards,
> Behi
>

Reply via email to