Revisiting WW-2501: No JavaScript in sx:div
-------------------------------------------

                 Key: WW-2961
                 URL: https://issues.apache.org/struts/browse/WW-2961
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.1.2
         Environment: Windows, Tomcat, Java/Jsp, Struts 2.1.2, FireFox 2.3.x 
and 3.0.5, IE 6.
            Reporter: Robert Garverick


I know you have looked at this problem in previous issues (e.g. WW-2501), but 
please take another look using my example.  The problem is that when an 
sx:tabbedpanel's sx:div hrefs another page, JavaScript doesn't work within the 
href'd page.  I don't understand why Struts-2/Dojo would not be able to handle 
this.  It forces my project to use include statements to pull pages into 
sx:divs when we would rather use href's.

In the following example, two pages are shown: a parent page and an href'd 
page.  In the parent page's sx:tabbedpanel, the first tab's sx:div hrefs 
hrefPage.jsp, which in turn contains JavaScript alerts in its <head> and 
<body>.  The parent page's alerts pop up, but not those of the href'd page.  It 
doesn't matter whether the JavaScript is in the <head> or the <body> of the 
href'd page.  Note that executeScripts and separateScripts are both true.  The 
FireFox error console shows no errors, but the following dojo debug messages 
result:
          DEBUG: widget ID collision on ID: parentTab1Div
          DEBUG: widget ID collision on ID: parentTab2Div
          DEBUG: widget ID collision on ID: parentTab3Div
          DEBUG: Error running scripts from content: undefined
          DEBUG: Error running scripts from content: undefined
          DEBUG: Error running scripts from content: undefined

PARENT PAGE:

<html>
<head>
    <script type="text/javascript">alert("JavaScript alert 1: parent page 
<head>")</script>
    <sx:head debug="true" />
</head>
<body>

<sx:tabbedpanel id="parentTabbedPanel">
    <s:url id="url" value="/pages/hrefPage.jsp"/>
    <sx:div id="parentTab1Div" label="ParentTab1" labelposition="top" 
href="%{url}"
            executeScripts="true" separateScripts="true">
        <script type="text/javascript">alert("JavaScript alert 2: parent page 
Tab1 div")</script>
    </sx:div>
    <sx:div id="parentTab2Div" label="ParentTab2" labelposition="top">
        Parent Tab2 Content
    </sx:div>
    <sx:div id="parentTab3Div" label="ParentTab3" labelposition="top">
        Parent Tab3 Content
    </sx:div>
</sx:tabbedpanel>

</body>
</html>

HREF'D PAGE:

<html>
<head>
    <script type="text/javascript">alert("JavaScript alert 3: from href page 
<head>")</script>
</head>
<body>
    <script type="text/javascript">alert("JavaScript alert 4: from href page 
<body>")</script>
    Some content.
</body>
</html>





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to