myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Delbecq <delbd+jaka...@oma.be>
Subject Re: JSF Dropdown Perfomance Issues
Date Tue, 08 May 2007 16:36:03 GMT
En l'instant précis du 08/05/07 17:52, bansi s'exprimait en ces termes:
>
> <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> 
>
>
> Here are my concerns
> - Just picking a value from the dropdown shouldn't result in a call to
> database especially when there are no changes made to database
>   
When you pickup a data an submit form (that's what a4j does), JSF ensure
the value user selected is in the list of available values. This is part
of validation process. To do this, it iterate over child select items,
resulting in a call to get f:selectItems entries, resulting in
evaluation of #{manufacturerBean.manufacturerList}. If you want to
prevent useless database calls, you must do it in manufacturerList.
f:selectItems is stateless and won't keep the list in cache.

Note: you might want to consider the Hibernate second level cache &
query caching to prevent too many database queries.





Mime
View raw message