Tapestry
  1. Tapestry
  2. TAPESTRY-1070

no id specified on the rendered Body element

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1
    • Fix Version/s: 4.1.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java SDK 5.0
      Apache Tomcat/5.5.9

      Description

      I am trying the basic example of Tapestry 4.1 given on this link http://tapestry.apache.org/tapestry4.1/ajax/EventListener.html

      But the Ajax functionality does not seems to work .... I posted this on the mailing list and Jesse Kuhnert suggest that no id for the Body element.

      Browser Output (View Source)
      --------------------------------------------
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
      Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
      <!-- Application: null -->
      <!-- Page: Home -->
      <!-- Generated: Thu Aug 17 00:10:00 PKT 2006 -->
      <html>
      <head>
      <meta name="generator" content="Tapestry Application
      Framework, version 4.1"/>
      <meta http-equiv="Content-Type"
      content="text/html;charset=UTF-8"/>
      <base
      href="http://localhost:8080/whiteboard/"/><!--[if
      IE]></base><![endif]-->
      <title>Whiteboard</title>
      <script type="text/javascript">djConfig =

      { isDebug: true, debugContainerId:'debug', baseRelativePath:"http://localhost:8080/whiteboard/app?service=asset&path=%2Fdojo%2F", preventBackButtonFix: false, parseWidgets: false }

      ;
      </script>

      <script type="text/javascript"
      src="http://localhost:8080/whiteboard/app?service=asset&path=%2Fdojo%2Fdojo.js"></script><script
      type="text/javascript"
      src="http://localhost:8080/whiteboard/app?digest=70bde2c664cbcfa071d91ccec1438f38&service=asset&path=%2Ftapestry%2Fcore.js"></script>

      <script
      type="text/javascript">dojo.require("dojo.logging.Logger");
      dojo.log.setLevel(dojo.log.getLevel("WARNING"));</script></head>

      <body>
      <script type="text/javascript"><!--
      dojo.require("dojo.event");
      dojo.require("tapestry.*");
      // --></script>

      <div id="myFavoriteDiv">
      Big brother is watching you ...
      </div>

      <script type="text/javascript"><!--
      dojo.event.connect(window, 'onload', function(e) {

      dojo.event.connect(dojo.byId("$Body"),
      "onmouseover", function(e) {
      var
      content=

      {beventname:"onmouseover"}

      ;

      tapestry.event.buildEventProperties(e, content);
      if (!content["beventtarget.id"])
      content["beventtarget.id"]="$Body";

      tapestry.bind("/whiteboard/app?component=%24Body&page=Home&service=directevent",
      content);
      });

      dojo.event.connect(dojo.byId("myFavoriteDiv"),
      "onmouseover", function(e) {
      var
      content=

      {beventname:"onmouseover"}

      ;

      tapestry.event.buildEventProperties(e, content);
      if (!content["beventtarget.id"])
      content["beventtarget.id"]="myFavoriteDiv";

      tapestry.bind("/whiteboard/app?component=%24Body&page=Home&service=directevent",
      content);
      });
      });
      // --></script></body>
      </html>

      <!-- Render time: ~ 985 ms -->

      Home.java
      ---------------
      package whiteboard.pages;

      import org.apache.tapestry.annotations.EventListener;
      import org.apache.tapestry.event.BrowserEvent;
      import org.apache.tapestry.html.BasePage;

      public abstract class Home extends BasePage
      {
      @EventListener(elements = "myFavoriteDiv", events ="onMouseOver", async=true)
      public void watchText(BrowserEvent event)

      { System.out.println("User clicked on x/y coordinates" + event.getPageX() + "/" + event.getPageY()); }

      }

      Home.html
      ----------------
      <html jwcid="@Shell" title="Whiteboard" ajaxEnabled="ognl:true">
      <body jwcid="@Body">

      <div id="myFavoriteDiv">
      Big brother is watching you ...
      </div>

      </body>
      </html>

      app.application
      ----------------
      <?xml version="1.0"?>
      <!DOCTYPE application PUBLIC
      "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
      "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">

      <application>
      <meta key="org.apache.tapestry.page-class-packages" value="whiteboard.pages"/>
      </application>

      web.xml
      ----------------
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <display-name>Whiteboard</display-name>

      <servlet>
      <servlet-name>app</servlet-name>

      <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
      <load-on-startup>0</load-on-startup>
      </servlet>

      <servlet-mapping>
      <servlet-name>app</servlet-name>
      <url-pattern>/app</url-pattern>
      </servlet-mapping>

      </web-app>

        Activity

        Hide
        Jesse Kuhnert added a comment -

        Added id attribute render to Body component.

        Show
        Jesse Kuhnert added a comment - Added id attribute render to Body component.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Tahseen Ur Rehman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development