Thank you for your quick response.

There isn't any buisness logic in the get method itself just access to the
data model, modelled rather directly after the example code provided
(which builds a non-cached TreeNode tree dicretly in the get property
method, although it's data-aquisition is much cheaper than mine).

Armed with the knowledge that multiple access to the property is allowed
and expected behaviour, I'll deal with it, easily enough. I was mostly
concerned that things weren't as they should be in my installation.

Thanks,
    Johan


> I am assuming you put business logic in your get property method?
>
> If so, JSF components have the right to call property getters as many
> times as they want. You should not put business logic in a get
> property method. For instance, putting EL in a rendered property
> causes that property to be called many times (usually >= once per
> phase). There is no caching of EL values in JSF. That would cause even
> more problems as you would not be able to change a EL evaluation once
> it had been evaluated once per page and would be disastrous for
> components like UIData
>
> If not, could you post more of the code (java for example)?
>
> Thanks,
> Andrew
>
> On 8/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Greetings,
>>
>> I seem to be experiencing problems with getting a a mthod on a Tree2
>> model
>> called twice per page-load. While the data is cachable if it was only a
>> matter of hammering the database, but I'm concerned about the general
>> performance implications.
>>
>> The Tree2 backing bean is derived from TreeBacker.java as it exists in
>> the
>> tomahawk examples, and the Tree2 tree is based on the client-side
>> example
>> in the same (and affect all tree2 instance on the page, wether client or
>> server-side. With two tables on the page, the bean gets access four
>> times,
>> even though there is only one reference to the backing bean in each
>> table,
>> in the value binding.)
>>
>> The binding looks like this:
>>
>> <t:tree2 id="clientTree" value="#{treeBacker.treeData}" var="node"
>> varNodeToggler="t" showRootNode="false">
>>
>> The rest of the definition contains facets and references to both the t
>> and node variables, but no references to treeBacker
>>
>> The tree itself actually renders as expected, and while rendering, the
>> following output (minus trimming of pointless sql) gets logged.
>>
>> Hibernate: select <a set of items for parent nodes)
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> 2006-aug-01 19:57:55
>> org.apache.myfaces.shared_tomahawk.config.MyfacesConfig
>> getStringInitParameter
>> INFO: No context init parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS'
>> found, using default value
>> org.apache.myfaces.renderkit.html.util.DefaultAddResource
>> Hibernate: select <a set of items for parent nodes)
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> Hibernate: select count(*) <part of a leaf node>
>> 2006-aug-01 19:57:56 org.apache.myfaces.shared_impl.config.MyfacesConfig
>> getStringInitParameter
>> INFO: No context init parameter 'org.apache.myfaces.ADD_RESOURCE_CLASS'
>> found, using default value
>> org.apache.myfaces.renderkit.html.util.DefaultAddResource
>>
>>
>>
>> It appears to me that the page in question gets rendered twice, once by
>> tomahawk, and once by myfaces core, which would explain it, but then
>> surely that means I set up my web.xml entris wrong.. let's have a look
>> at
>> them too..
>>
>>    <servlet>
>>       <servlet-name>Faces Servlet</servlet-name>
>>       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>       <load-on-startup>1</load-on-startup>
>>    </servlet>
>>
>>    <servlet-mapping>
>>       <servlet-name>Faces Servlet</servlet-name>
>>       <url-pattern>*.faces</url-pattern>
>>    </servlet-mapping>
>>
>>    <filter-mapping>
>>       <filter-name>MyFacesExtensionsFilter</filter-name>
>>       <servlet-name>Faces Servlet</servlet-name>
>>    </filter-mapping>
>>
>>    <filter-mapping>
>>       <filter-name>MyFacesExtensionsFilter</filter-name>
>>       <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
>>    </filter-mapping>
>>
>>
>> Well, that looks alright to me, and I'm at a loss to explain the doubled
>> calls to the backing bean, or double rendering of the page, if that is
>> what is happening.
>>
>> tomahawk and myfaces core version are:
>>
>> myfaces-api:            1.1.3
>> myfaces-impl:           1.1.3
>> tomahawk:               1.1.3
>>
>> Anyone with any ideas and a bit more experience than me perhaps could
>> tell
>> me what to look for?
>>
>> Thanks in advance,
>>
>>      Johan
>>
>>
>
>


Reply via email to