0

I have a JSP that uses DOJO Datepicker. It runs fine on my laptop where I have Netbeans6.9/tomcat 6.x installed. However, when I upload it to my hosting service, the DOJO Datepicker doesn't show while the rest of the page shows up fine!

My web app is developed using Java Struts2.

I compared the source code between the two environments (local & remote). And I noticed that has no effect on the remote page. Where on the local page it translates to some DOJO configuration.

Remote page:

<head>
<title>Profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="MainLayout.css" rel="stylesheet" type="text/css">
</head>

Local Page:

<head>
   <title>Contract Profile</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="MainLayout.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/javascript">
// Dojo configuration
djConfig = {
    isDebug: false,
    bindEncoding: "UTF-8"
      ,baseRelativePath: "/sm/struts/dojo/"
      ,baseScriptUri: "/sm/struts/dojo/"
     ,parseWidgets : false

};
</script>

<script language="JavaScript" type="text/javascript"
    src="/sm/struts/dojo/struts_dojo.js"></script>

<script language="JavaScript" type="text/javascript"
    src="/sm/struts/ajax/dojoRequire.js"></script>
<link rel="stylesheet" href="/sm/struts/xhtml/styles.css" type="text/css"/>

<script language="JavaScript" src="/sm/struts/utils.js" type="text/javascript"> </script>
<script language="JavaScript" src="/sm/struts/xhtml/validation.js" type="text/javascript"></script>
<script language="JavaScript" src="/sm/struts/css_xhtml/validation.js" type="text/javascript"></script>
</head> 

In addition, FireBug, gives me object dojo not defined message on loading the page remotely. These are clear signs that it's not behaving the same.

But the question is what do I do so it does? Your help is much appreciated as I really getting disperate.

Shobbi
  • 897
  • 6
  • 9
  • Your HTML fragments are confusing. Local one contains SCRIPT elements, the remote one does not. Also the TITLE element is different. Are you sure the remote version is correct? Btw. always check HTML source via CTRL+U (view source) as Firebug is only showing parsed content (but you are probably doing that). – Pavel Horal Apr 01 '12 at 11:25
  • Thanks Pavel, the confusion in the two script is the cause of the problem. – Shobbi Apr 02 '12 at 06:59

1 Answers1

0

"dojo not defined" means dojo didn't load.

Go to the network tab in firebug and find the full path for dojo.js

http://mydomain.com/contextPath/static/dojo/dojo.js

Chances are this will be in red, meaning that firefox couldn't load the resource.

The problem is probably one of the following:

  • The dojo files are in a different path. The contextPaths might be different between your development and production environments and you have it hard coded for your development environment.
  • Your build script that builds the war file did not include the dojo javascript and it is missing entirely on the production environment.
Craig Swing
  • 8,152
  • 2
  • 30
  • 43
  • Thanks Craig, I will do that and post back. However, I got so frustrated with issue that I took out DOJO controls off my page and went ahead with STRUTS2 textfield for the time being. Just so I can move on. Wasted too much time on this. To top off, my web hosting service support really sucks! – Shobbi Apr 02 '12 at 07:02