myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Robinson" <andrew.rw.robin...@gmail.com>
Subject Re: Caching JSF Dropdown Results
Date Wed, 23 May 2007 18:54:09 GMT
How about <t:saveState value="#{manufacturerBean.manufacturerList}"
/>? If you are using a4j:region, you will need to make sure the save
state tag in in the region (BTW - I haven't tested this).

On 5/23/07, bansi <mail2bansi@yahoo.com> wrote:
>
> I have  following dropdown
>
> Code:
>
> <h:panelGrid columns="3" styleClass="detail" columnClasses="label">
>           <h:outputText value="Manufacturer" />
>
>           <h:selectOneMenu id="manufList"
> value="#{manufacturerBean.selectedManufacturer}" >
>             <f:selectItem itemLabel="New" itemValue="New" />
>
>               <f:selectItems value="#{manufacturerBean.manufacturerList}" />
>               <a4j:support
> action="#{manufacturerBean.loadManufacturerDetails}" event="onchange"
> reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />
>            </h:selectOneMenu>
>             </h:panelGrid>
>
>
> The perfomance issue is Whenever i pick a  value from the dropdown it
> results in 3 datbase calls
> Here is the sequence of method calls
> - First time the method in f:selectItems gets called which results in a
> database call
> <f:selectItems value="#{manufacturerBean.manufacturerList}" />
> - Second time as expected/desired Ajax4JSF onchange event action method gets
> called
> <a4j:support action="#{manufacturerBean.loadManufacturerDetails}"
> event="onchange"
> reRender="manufName,manufDescription,manufSource,btnSave,btnDelete" />
> - Third time again the method in f:selectItems gets called which results in
> a database call
> <f:selectItems value="#{manufacturerBean.manufacturerList}" />
>
> I understand its due to JSF Lifcycle.
>
>
> Any pointers/suggestion on how to Cache the method getManufacturerList() to
> avoid unnecessary database calls will be highly appreciated
>
> Regards
> Bansi
>
> --
> View this message in context: http://www.nabble.com/Caching-JSF-Dropdown-Results-tf3805830.html#a10770409
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message