users@woodstock.java.net

Re: change in span id generation [was Re: multiple JSF portlet error: javascript init problem?]

From: Istvan Soos <syntern_at_sch.bme.hu>
Date: Wed, 19 Mar 2008 23:11:51 +0100

On Mar 19, 2008, at 10:01 PM, Dan Labrecque wrote:

> Istvan Soos wrote:
>>
>>
>> On Mar 19, 2008, at 4:48 PM, Dan Labrecque wrote:
>>
>>> Istvan Soos wrote:
>>>> Hi Dan,
>>>>
>>>> I've checked it: If there is only one portlet, the id of e.g.
>>>> input text field is unique (even contains the portlet id, as
>>>> expected). The first immediate parent (span) of the input element
>>>> has good id too, however the second span element uses only a
>>>> simple j_id16 like id, that causes the problem. (This span is
>>>> direct child of the form element).
>>>> If there are two portlets, as I cannot see input elements, I
>>>> cannot inspect their IDs, only the form's hidden input field is
>>>> accessible. That id looks fine however, as it contains separate
>>>> id for the separate portlets.
>>>>
>>>> I think there will be a definite need to change either this id or
>>>> the JavaScripts that initialize themselves using this id, as it
>>>> just brakes the JSF-portlet concept if we cannot add more than
>>>> one JSF-portlet on one single page. The question is the where and
>>>> how...
>>>
>>> If you want to file a bug, I'll try to get this change in for the
>>> next 4.2 milestone. This build will be integrated into NetBeans
>>> 6.1 RC1 (Mar 27).
>>
>> Hi Dan,
>>
>> Thanks for this, I really appreciate it. I'll file a bug (and if I
>> have the time a patch) later today (when I arrive home)... I
>> suppose this stuff is handled inside the following file: ./webui/
>> src/runtime/com/sun/webui/jsf/renderkit/widget/RendererBase.java
>
> Correct. If you're building Woodstock yourself, here is the fix I
> have applied in my own workspace.
>
> Line 100: String id = context.getViewRoot().createUniqueId();
> Becomes: String id = "_" + component.getClientId(context);

I've tried your suggestion and other ideas too, however it is still
not perfect. This modification is definitely one step further and
required, as if I use this, I see one JSF portlet working (the last
one on the page). The ids seem to be ok, but the other portlets just
do not show anything. That leaves one last option: there is some
initialization code that creates some inconsistency. I am not a
JavaScript guy, so I am unable to tell where could be this one
wrong... Any idea I can look into?

Thanks,
    Istvan