Import Template - Control ID doesn't resolve properly

Hi,

There seems to be a problem resolving control id references when using the import template view.
In attachment you may find a sample able to reproduce the issue.
On my sample I have created a portlet with two views: Default and innerView.

On the default view you will find two tabs: One and Two.
For each of the tabs there’s an hideable panel with an import template view control within.

On the inner view you will find 2 controls: htmlOutputText (a basic text output) and htmlButton
I’ve placed a line of javascript (

alert("#{caf:cid('htmlOutputText')}");

) on the button so that it prints the control id reference for htmlOutputText.

The general rule for control id reference resolution is that it resolves for the “closest” control with the specified id. So, when inside tab Two, I was expecting it to resolve to jsfwmp19782:defaultForm:importTemplateTwo:innerForm:htmlOutputText (notice the importTemplateTwo part) but it resolves to jsfwmp19782:defaultForm:importTemplateOne:innerForm:htmlOutputText

Best regards,
Bruno
ImportTemplateNamespaceProblem.zip (16.5 KB)

(from our JSF expert)
If you are looking up the component from java code, you can definitely find the nearest component by using the findComponent(…) java API which does a depth-first search to find the nearest component (relative to the ‘base’ component) with the specified id. See: http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_fcs/My_webMethods_and_Task_Engine/8-2_CAF_and_MWS_Java_API_Reference/com/webmethods/caf/faces/bean/BaseViewBean.html#findComponent(UIComponent,%20java.lang.String)

However, in your use case it appears that they are just trying to resolve the id using an expression that is resolved during rendering. In this case, the framework doesn’t know what the ‘base’ component is to know where to begin the search from, so it always resolves the component from the root which would always find the first one (as expected).

My suggestion would be to use a more specific id for the lookup.

For example:
#{caf:cid(‘templateOneViewId:htmlOutputText’)}
#{caf:cid(‘templateTwoViewId:htmlOutputText’)}