[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Content replace  XML
Forum Index -> Development
Author Message
hilka

Power User

Joined: 23/11/2007 09:00:08
Messages: 191
Offline

Hello,

I use rowinclude components to integrate different pages within one page.
Since I don't want to access the members of these beans by dispatcher, I manage the beans from the enclosing page's bean. Therefore I use the contentreplace feature of the rowinclude tag.
Works perfectly fine for static content (content defined in the jsp). But when I add some tags to the component tree at runtime, the contentreplace feature of the rowinclude tag seems to be ignored.

Do I have to manage the content replace inside my bean for the dynamic contents?

Tobias
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi Tobias,

what you desribe is 100% right: the contentreplace is only applied to the static content of the page. If you add content dynamically then you have to update the expressions in your program that creates the dyamic content.

This means: you need to pass the replace value into this code. Either you pass it within the contructor (or somewhere else) and then have to by very careful to keep page definitions in synch with code definitions, OR you use the special purpose control: t:beanpropertysetter which allows to set a property from the page.

Example: the imagecapture control has a .jsp page which is defined the following way:

Code:
 <f:view>
 <h:form>
 <f:subview id="eclntjsfserver_includes_imagecaptureg_10">
 <t:beanprocessing id="g_2" >
   <t:beanpropertysetter id="g_3" property="#{v_imagecapture.refExpression}" value="v_imagecapture" />
 </t:beanprocessing>
 <t:row id="g_4" >
   <t:pane id="g_5" >
   ...
   ...
 


You see: the property refers to #{v_imagecapture.refExpression} and passes the value v_imagecapture. When now including this page (which is implicitly done by the t:imagecapture component) then the contentreplace is something like "v_imagecapturexx". This means the property of the corresponding bean is automatically set in a right way. - There is no "keep in synch!" required by your application.

Björn

Björn Müller, CaptainCasa GmbH
hilka

Power User

Joined: 23/11/2007 09:00:08
Messages: 191
Offline

Hello Björn,

thank you for your help.

But there is still one question to me: The beanprocessing is executed when the rowinclude is performed. Right?
I have a dynamic environment, so I do not know which page to include.
So, to set the string for content replace, I initially have to know the prefix (like d.queryDefinition) in my bean class, because at this point, the setter which sets the property is not executed yet. Right?
So I still have to know the prefix initially in the bean. Afterwards, the setter is invoked and I don't have any problems with keeping in synch.

Tobias
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi Tobias,

yes it is executed first time when the include is "materialized" (i.e. the JSF encode face of the response rendering). But, at least in my examples + up to now, this was enough because it happens before the/your dynamic components are added into the page. You need to make sure that the t:beanpropertsetter is quite at the top of your page, of course.

...does this help you?...

Björn

Björn Müller, CaptainCasa GmbH
hilka

Power User

Joined: 23/11/2007 09:00:08
Messages: 191
Offline

Hello Björn,

not really because I have to know the content replace string in order to build the rowinclude. But the beanproperty is not set until the rowinclude is done.
By the way I have the beanprocessing tag on top of my page.

Tobias
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

...got it. Yes, you need to define the ROWINCLUDE-CONTENTREPLACE before the phase I described in the statement above. My property setting just drills down the replacement string into the processing of the page so that you do not have to do this from your Java code as well.

But I think there is no way round on this: it's like defining the server side binding with a normal control...

Björn

Björn Müller, CaptainCasa GmbH
hilka

Power User

Joined: 23/11/2007 09:00:08
Messages: 191
Offline

Hello Björn,

I still have some problems using the content replace feature. But this time it is not about replacing the strings. This works fine.

But there is another problem:
I have a List of buttons. Each of the buttons trigger a new content page. To fill the content page with data, I have to use the rowinclude feature (dynamic pages). The content replace works perfectly fine for the first button I select (not the first in the list but the first I select). Selecting a second button does work (the content is switched to the other page) but I think the content replace is not executed any more. The framework tries to find the beans with the unreplaced expressions.
If I select the first button again, everything works fine for this button, but not for any other button.
Restarting the application and selecting another button first works fine for the first button, but not for any other button (so the pages are ok).

You told me that sometimes you send a command only ones. Is this the problem? Do you have any ideas what could be wrong here?

Thanks for your help.

Tobias
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5519
Offline

Hi Tobias,

this an error which was fixed 2 days ago. Please use the current beta and it should not occur anymore.

The ROWINCLUDE did not renew its content when the page itself did not change... Well, in your case, the page stays the same but only the contentreplace changes.

Björn

Björn Müller, CaptainCasa GmbH
hilka

Power User

Joined: 23/11/2007 09:00:08
Messages: 191
Offline

Hello Björn,

thanks for your help. Will try this tomorrow.

Tobias
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team