users@woodstock.java.net

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

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Mon, 31 Mar 2008 09:27:29 -0500

Istvan Soos wrote:
>> I don't have a workaround, yet. Still not sure what is happening in
>> your environment?
>
> I think I have some idea, your alert based check gave me the solution.
> You were right, the bootstrap.js shall be right (although it was not
> suntheme4_2 but 4_3 as I was using the latest build).
>
> At the moment, the
> <webuijsf:themeLinks binding="#{PortletPage1.themeLinks1}"
> id="themeLinks1"/>
>
> produces something like this:
> <script ... >var webui_suntheme4_3={ ... };</script>
> <script src="/.../bootstrap.js">
>
> Now if I commented out the themeLinks tag and replaced it with the
> following JavaScript, it was fine:
>
> <script type="text/javascript">
> if (typeof webui == "undefined") {
> var
> webui_suntheme4_3={"webuiJsfx":false,"webuiAll":false,"theme":{"locale":"en-us"},"ajax":{"isJsfx":true},"isDebug":false,"isStyleSheet":true,"parseOnLoad":true};
>
> document.write('<script type="text/javascript"
> src="/JSTestJSF1/theme/com/sun/webui/jsf/suntheme4_3-080326/javascript/bootstrap.js"></script>');
>
> }
> </script>
>
> Basically I have reduced the webui_suntheme4_3 reference creation and
> the JS include to be one-time only by checking the webui variable. It
> is fine for multiple portlet!
>
> Is it possible for you to rewrite the generated JavaScript code for
> the themeLinks tag to produce something similar like this one?

Well, the bootstrap.js file already contains a similar "if" statement.
I'd like to understand what the underlying problem is before we change
the themeLinks tag.

Can you try adding the script tag for the bootstrap.js file and omit the
"if" statement and webui_suntheme4_3 variable? (The variable is not
required unless the locale changes.) I'm still curious if this is a
problem with this variable or including the bootstrap.js file?

Another thing you can try is the following (without the "if" statement):

this.webui_suntheme4_3= {...}
<script type="text/javascript"
src="/JSTestJSF1/theme/com/sun/webui/jsf/suntheme4_3-080326/javascript/bootstrap.js"></script>

I'm curious if there is a problem redefining the same "var" -- the
keyword "this" might work better.

Thanks,
Dan