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: Fri, 21 Mar 2008 14:58:20 +0100

>>

Hi Dan,

I've built the latest CVS repository code, but it didn't work. I
modified the RendererBase.java the following way:
from:
         String id = "_"+component.getClientId(context);
to
         String id = component.getClientId(context);

This was because the HTML source contained references for both
__someid (with 2 '_' chars) and _someid (with 1 '_') but with the
modification it contians only with one '_' in the beginning.

Still, it does not work. Even it is a bit worse, as not even the
'last' portlet is working.


> Well, the only reason JavaScript would be overridden is if the code
> above were included more than once.

But it is included more than once, as each portlet contains this code.
Check the HTML source I've included.



The page contains three portlets, search for the [div class="portlet-
content-container"] string, it is the beginning part of the individual
portlets, and the include codes are the following:

this is the rYx6 portlet instance:

<script type="text/javascript">var
webui_suntheme4_2={"webuiJsfx":false,"webuiAll":false,"theme":
{"locale":"en-us"},"ajax":
{"isJsfx
":true},"isDebug":false,"isStyleSheet":true,"parseOnLoad":true};</script
><script type="text/javascript" src="/IPCSampleJSFPortlet/theme/com/
sun/webui/jsf/suntheme4_2-080321/javascript/bootstrap.js"></script>
<form
id
=
"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_rYx6_:form1" ...>
<span
id
=
"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_rYx6_
:form1:staticText1">
<script type="text/
javascript
">
webui
.suntheme4_2
.widget
.common
._createWidget
('_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_rYx6_
:form1:staticText1',
{"id
":"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_rYx6_
:form1
:staticText1
","widgetType":"webui.suntheme4_2.widget.staticText","style":"left:
24px; top: 24px; position:
absolute","visible":true,"value":"Input:","escape":true});</script></
span>

and this is the 0QfU portlet instance:

<script type="text/javascript">var
webui_suntheme4_2={"webuiJsfx":false,"webuiAll":false,"theme":
{"locale":"en-us"},"ajax":
{"isJsfx
":true},"isDebug":false,"isStyleSheet":true,"parseOnLoad":true};</
script>
<script type="text/javascript" src="/IPCSampleJSFPortlet/theme/com/sun/
webui/jsf/suntheme4_2-080321/javascript/bootstrap.js"></script>
<form
id
=
"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_0QfU_:form1" ...>
<span
id
=
"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_0QfU_
:form1:staticText1">
<script type="text/
javascript
">
webui
.suntheme4_2
.widget
.common
._createWidget
('_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_0QfU_
:form1:staticText1',
{"id
":"_IPCSampleJSFPortlet_WAR_IPCSampleJSFPortlet_INSTANCE_0QfU_
:form1
:staticText1
","widgetType":"webui.suntheme4_2.widget.staticText","style":"left:
24px; top: 24px; position:
absolute","visible":true,"value":"Input:","escape":true});</script></
span>


> And that no longer appears to be the case here. Unfortunately, all
> my work is being done in the 4.2 release, so I'm not sure what else
> we can try? Other than to have you provide step by step instructions
> to recreate your example app or forward your Netbeans project.

I can provide such, however at the moment it requires either a full
liferay build from the trunk or try it on other portal servers which I
am unfamiliar with. I hope the stuff I wrote together this time will
help us, if not, I will write a full guide how to get this work on
Liferay+NetBeans...

> Would you mind sending the previously attached files, again? (I
> can't seem to retrieve the attachments from the e-mail archive.) I
> have an idea of what the IDs look like from the form tag above, but
> I want to see what IDs are being provided to the widget JavaScript.
> If you have updated your Woodstock build with my suggested fix, I'd
> like to see the HTML page source for that, too.

This time the ID looks better (either with or without the leading '_'
char), I have a strong feeling the only problem is around the
JavaScript bootstrap code... Is it possible to include some workaround
that won't run the second / third / ... bootstrap?

Thanks,
    Istvan