You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sharath karnati <ka...@yahoo.com> on 2008/03/28 15:07:02 UTC

dojo is not defined error message in firefox console.

Hi All,
   
    I'm getting below error message for this acrion(http://localhost:7001/hibernate/events/Dojo.action).
   
      dojo is not defined
       dojo.require("dijit.form.Button");
   
    Please find my progrm:
     
<html>
<head>
<s:head theme="ajax" debug="true"/>
<title>TooltipDialog demo</title>
  <script type="text/javascript">
    // Dojo configuration
    djConfig = {
     parseOnLoad: true,
        baseRelativePath: "<@s.url includeParams='none' value='/struts/dojo' includeParams='none' encode='false'/>",
        isDebug: true,
        bindEncoding: "${parameters.encoding}",
        debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes        
    };
</script>
<script type="text/javascript"
        src="<@s.url includeParams='none' value='/pages/dojoroot/dojo/dojo.js' includeParams='none' encode='false'/>">
</script>
  
 <link href="<s:url value='/pages/dojoroot/dojo/resources/dojo.css'/>" rel='stylesheet' type='text/css' />
 <link href="<s:url value='/pages/dojoroot/dijit/themes/tundra/tundra.css'/>" rel='stylesheet' type='text/css' />          
  <script type="text/javascript">
         dojo.require("dijit.Dialog");
            dojo.require("dijit.form.Button");
</script>
    
</head>
<body class="tundra">
  <button dojoType="dijit.form.Button" id="helloButton">
                        Hello World
                        <script type="dojo/method" event="onClick">
                                console.log('you pressed the button');
                                alert("You pressed the button.");
                        </script>
   </button>
</body>
</html> 
   
    In struts.xml, I configured this program as below
   
      <action name="Dojo">
 <result>/pages/test1.jsp</result>
    </action>
     
  dojoroot directory is in WEB-INF/pages directory. I'm using 'struts2-core-2.0.11.jar'
     
  Please let me know what is wrong in this code and how to correct this problem.
     
  Thanks in advance.
   
  Regards,
Sharath.

       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Re: dojo is not defined error message in firefox console.

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Are you deliberately mixing Dojo 0.40 with Dojo 1.x?

The <s:head theme=ajax> tag includes resources for Dojo 0.40. In 
addition to that you're referenced a local dojo installation that 
includes Digit (1.x)

The "dojo undefined" message implies neither worked so there's a major 
error.  Use FireBug to confirm that dojo.js is found.

sharath karnati wrote:
> Hi All,
>    
>     I'm getting below error message for this acrion(http://localhost:7001/hibernate/events/Dojo.action).
>    
>       dojo is not defined
>        dojo.require("dijit.form.Button");
>    
>     Please find my progrm:
>      
> <html>
> <head>
> <s:head theme="ajax" debug="true"/>
> <title>TooltipDialog demo</title>
>   <script type="text/javascript">
>     // Dojo configuration
>     djConfig = {
>      parseOnLoad: true,
>         baseRelativePath: "<@s.url includeParams='none' value='/struts/dojo' includeParams='none' encode='false'/>",
>         isDebug: true,
>         bindEncoding: "${parameters.encoding}",
>         debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes        
>     };
> </script>
> <script type="text/javascript"
>         src="<@s.url includeParams='none' value='/pages/dojoroot/dojo/dojo.js' includeParams='none' encode='false'/>">
> </script>
>   
>  <link href="<s:url value='/pages/dojoroot/dojo/resources/dojo.css'/>" rel='stylesheet' type='text/css' />
>  <link href="<s:url value='/pages/dojoroot/dijit/themes/tundra/tundra.css'/>" rel='stylesheet' type='text/css' />          
>   <script type="text/javascript">
>          dojo.require("dijit.Dialog");
>             dojo.require("dijit.form.Button");
> </script>
>     
> </head>
> <body class="tundra">
>   <button dojoType="dijit.form.Button" id="helloButton">
>                         Hello World
>                         <script type="dojo/method" event="onClick">
>                                 console.log('you pressed the button');
>                                 alert("You pressed the button.");
>                         </script>
>    </button>
> </body>
> </html> 
>    
>     In struts.xml, I configured this program as below
>    
>       <action name="Dojo">
>  <result>/pages/test1.jsp</result>
>     </action>
>      
>   dojoroot directory is in WEB-INF/pages directory. I'm using 'struts2-core-2.0.11.jar'
>      
>   Please let me know what is wrong in this code and how to correct this problem.
>      
>   Thanks in advance.
>    
>   Regards,
> Sharath.
>
>        
> ---------------------------------
> Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 7.5.519 / Virus Database: 269.22.1/1347 - Release Date: 27/03/2008 7:15 PM
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: dojo is not defined error message in firefox console.

Posted by Rubens <ru...@hotmail.com>.
In your web.xml ensure you have a filter-mapping defined for the
/struts/...<js files>.  You need to make sure that a request to the
Javascript and CSS files defined in the struts jar file go thru the Struts 2
filter.  That is, make sure you have something like this on your web.xml:

    <filter-mapping>
        <filter-name>struts2Filter</filter-name>
        <url-pattern>/struts/*</url-pattern>
    </filter-mapping>


If the request to your struts 2 dojo javascript files do not go thru the
Struts 2 filter, you will get 404 error when the browser attempts to
retrieve those files.

Rubens.
-- 
View this message in context: http://www.nabble.com/dojo-is-not-defined-error-message-in-firefox-console.-tp16353614p19850121.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org