You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andreas Schenk <dr...@gmx.net> on 2005/10/29 00:39:25 UTC

Dynamic include not working / component tree growing indefinitely

Hi,

I am trying to dynamically include jsp pages using the following construct:

main.jsp:

[....]
<body>
<f:view>
	<h:form>
	 	<jsp:useBean class="de.gas.web.app.TestBean" id="testbean"
			scope="session" />
		<jsp:include page="${testbean.path}" />
	</h:form>
</f:view>
</body>
</html>

For every request testbean.path yields the page to include. The page may 
change for every request. These pages are of the form:

included_page.jsp (example)
[...]
<f:subview id="a2">
	<h:commandButton type="submit" value="HALLO" id="hallo"
		action="#{testbean.act}" actionListener="#{testbean.listen}" />
	<h:inputText value="#{testbean.s}" />
</f:subview>


I have a couple of pages to include, with subview-id "aN", where N = 1, 2, 
3, .... (for example).

According to the browser, this seems to work well. Looking at the debugger, it 
does not, however. What goes wrong:

If the first page included has id a1, then a NamingContainer component with id 
a1 is added as a child component to the form component. If the next request 
requires the inclusion of the page "a2", then a NamingContainer component 
with id a2 is added as child to the form component as well. However, the 
first NamingContainer with id a1 is not removed from the tree. But this 
should happen. Otherwise the component tree is growing with every new page 
included. Hence, the application will not scale well. 

This is not what I expect to happen. If a different page is included, the 
component subtree corresponding to the first page should be removed from the 
component tree before the new subtree corresponding to the second page is 
added.

Here are my questions:

(1) I am still working with the nightly build 20050812. Has the described 
behaviour changed in the meantime?

(2) If not, what should I do to get the desired behaviour?

(3) If there is currently no way to get the desired behaviour, is there a 
chance that myfaces will be enhanced appropriately?

Regards

Andreas Schenk

Re: Dynamic include not working / component tree growing indefinitely

Posted by Volker Weber <us...@weber-oldenburg.de>.

Volker.Weber wrote:
> Hello Andreas,
> 
> If i remenber correct, this must be somewhere in doEndTag() of
> UIComponentBase.

Must be UIComponentTag, not Base, off cause!

> I have no sources here, so i can't check this now.
> 
> regards
>  Volker
> 
> Andreas Schenk wrote:
> 
>> Am Samstag, 29. Oktober 2005 10:57 schrieb Volker.Weber:
>>  
>>
>>> Hi,
>>>
>>> When did you check this growing? Has you checked this behavior during
>>> more than two request circles, and are the components from first request
>>> still in the tree?
>>> As far as i know the unused 'old' components are removed at the end of
>>> the renderResponsePhase, so they shouln't still exists in the next
>>> request circle.
>>> If this is not the case, i think it's a bug and you should file an issue
>>> in the bug datase.
>>>
>>> Regards
>>>  Volker
>>>   
>>
>>
>> Hi Volker,
>>
>> thanks for your answer. You are right, I did check at the wrong place.
>> The old subtree is removed somewhere. I proved that with a sequence of
>> more than two pages. However, I didn't find the place, where the old
>> components are removed.
>>
>> Can you tell me more specifically where (and how) the old components
>> are removed? This interests me, since I would like to see whether it
>> is possible for the old components to write something to the response
>> on removal. (Suppose I write my own components)
>>
>> Regards
>>
>> Andreas Schenk
>>
>>  
>>
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Re: Dynamic include not working / component tree growing indefinitely

Posted by "Volker.Weber" <us...@weber-oldenburg.de>.
Hello Andreas,

If i remenber correct, this must be somewhere in doEndTag() of 
UIComponentBase.
I have no sources here, so i can't check this now.

regards
  Volker

Andreas Schenk wrote:

>Am Samstag, 29. Oktober 2005 10:57 schrieb Volker.Weber:
>  
>
>>Hi,
>>
>>When did you check this growing? Has you checked this behavior during
>>more than two request circles, and are the components from first request
>>still in the tree?
>>As far as i know the unused 'old' components are removed at the end of
>>the renderResponsePhase, so they shouln't still exists in the next
>>request circle.
>>If this is not the case, i think it's a bug and you should file an issue
>>in the bug datase.
>>
>>Regards
>>  Volker
>>    
>>
>
>Hi Volker,
>
>thanks for your answer. You are right, I did check at the wrong place. The old 
>subtree is removed somewhere. I proved that with a sequence of more than two 
>pages. However, I didn't find the place, where the old components are 
>removed.
>
>Can you tell me more specifically where (and how) the old components are 
>removed? This interests me, since I would like to see whether it is possible 
>for the old components to write something to the response on removal. 
>(Suppose I write my own components)
>
>Regards
>
>Andreas Schenk
>
>  
>


Re: Dynamic include not working / component tree growing indefinitely

Posted by Andreas Schenk <dr...@gmx.net>.
Am Samstag, 29. Oktober 2005 10:57 schrieb Volker.Weber:
> Hi,
>
> When did you check this growing? Has you checked this behavior during
> more than two request circles, and are the components from first request
> still in the tree?
> As far as i know the unused 'old' components are removed at the end of
> the renderResponsePhase, so they shouln't still exists in the next
> request circle.
> If this is not the case, i think it's a bug and you should file an issue
> in the bug datase.
>
> Regards
>   Volker

Hi Volker,

thanks for your answer. You are right, I did check at the wrong place. The old 
subtree is removed somewhere. I proved that with a sequence of more than two 
pages. However, I didn't find the place, where the old components are 
removed.

Can you tell me more specifically where (and how) the old components are 
removed? This interests me, since I would like to see whether it is possible 
for the old components to write something to the response on removal. 
(Suppose I write my own components)

Regards

Andreas Schenk

Re: Dynamic include not working / component tree growing indefinitely

Posted by "Volker.Weber" <us...@weber-oldenburg.de>.
Hi,

When did you check this growing? Has you checked this behavior during 
more than two request circles, and are the components from first request 
still in the tree?
As far as i know the unused 'old' components are removed at the end of 
the renderResponsePhase, so they shouln't still exists in the next 
request circle.
If this is not the case, i think it's a bug and you should file an issue 
in the bug datase.

Regards
  Volker

Andreas Schenk wrote:

>Hi,
>
>I am trying to dynamically include jsp pages using the following construct:
>
>main.jsp:
>
>[....]
><body>
><f:view>
>	<h:form>
>	 	<jsp:useBean class="de.gas.web.app.TestBean" id="testbean"
>			scope="session" />
>		<jsp:include page="${testbean.path}" />
>	</h:form>
></f:view>
></body>
></html>
>
>For every request testbean.path yields the page to include. The page may 
>change for every request. These pages are of the form:
>
>included_page.jsp (example)
>[...]
><f:subview id="a2">
>	<h:commandButton type="submit" value="HALLO" id="hallo"
>		action="#{testbean.act}" actionListener="#{testbean.listen}" />
>	<h:inputText value="#{testbean.s}" />
></f:subview>
>
>
>I have a couple of pages to include, with subview-id "aN", where N = 1, 2, 
>3, .... (for example).
>
>According to the browser, this seems to work well. Looking at the debugger, it 
>does not, however. What goes wrong:
>
>If the first page included has id a1, then a NamingContainer component with id 
>a1 is added as a child component to the form component. If the next request 
>requires the inclusion of the page "a2", then a NamingContainer component 
>with id a2 is added as child to the form component as well. However, the 
>first NamingContainer with id a1 is not removed from the tree. But this 
>should happen. Otherwise the component tree is growing with every new page 
>included. Hence, the application will not scale well. 
>
>This is not what I expect to happen. If a different page is included, the 
>component subtree corresponding to the first page should be removed from the 
>component tree before the new subtree corresponding to the second page is 
>added.
>
>Here are my questions:
>
>(1) I am still working with the nightly build 20050812. Has the described 
>behaviour changed in the meantime?
>
>(2) If not, what should I do to get the desired behaviour?
>
>(3) If there is currently no way to get the desired behaviour, is there a 
>chance that myfaces will be enhanced appropriately?
>
>Regards
>
>Andreas Schenk
>
>  
>