开发者

Is there something special required to use dijit widgets within a Struts2 application with the DOJO plugin?

开发者 https://www.devze.com 2022-12-20 01:25 出处:网络
I am taking a prototype of a web page and implementing it. The prototype makes heavy use of DOJO for some fancy UI elements. The application is built using Struts 2.1.8.1 with the DOJO plugin enabled.

I am taking a prototype of a web page and implementing it. The prototype makes heavy use of DOJO for some fancy UI elements. The application is built using Struts 2.1.8.1 with the DOJO plugin enabled. I am able to use the dojo specific tags within struts but I can't get the any of the dijit widgets to work.

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<html xmlns="\&quot;http://www.w3.org/1999/xhtml\&quot;" xml:lang="\&quot;en\&quot;" lang="\&quot;en\&quot;">

<head>
    <sx:head parseContent="true" />
    <script type="text/javascript"> 
dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.form.TimeTextBox");
dojo.require("dijit.form.Slider");
dojo.require("dijit.Menu");
       dojo.require("dijit.layout.AccordionContainer");    
       dojo.require开发者_运维问答("dojox.charting.Chart2D");
       dojo.require("dojox.charting.themes.PlotKit.blue");
       dojo.require("dojox.charting.themes.PlotKit.orange");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.SplitContainer");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.Tooltip");
   </script>

The error I'm getting is:

GET http://localhost:9080/quickstart/struts/dijit/Dialog.js
GET http://localhost:9080/quickstart/struts/dijit/Dialog.js 
404 Not Found

struts_dojo.js (line 769)
GET http://localhost:9080/quickstart/struts/dijit.js
GET http://localhost:9080/quickstart/struts/dijit.js
404 Not Found

struts_dojo.js (line 769)
ParamsHeadersPostPutResponseCacheHTML
Error 404: Error reported: 404

GET http://localhost:9080/quickstart/struts/dojo/__package__.js
GET http://localhost:9080/quickstart/struts/dojo/__package__.js
404 Not Found

struts_dojo.js (line 769)
ParamsHeadersPostPutResponseCacheHTML
Error 404: Error reported: 404

Could not load 'dijit.Dialog'; last tried '__package__.js'
[Break on this error] throw _13||Error(_12); 

Do I need to make a special build of Dojo to get access to these dijit widgets?


The answer is because struts, as late as Struts 2.1.8.1 which is the most recent version as I am writing this, includes DOJO 0.4. Dijit seems to have been introduced sometime after Dojo 1.0. (Current version is 1.4).

The widget library to use with Struts is Dojo.widget which gets loaded by default with struts.

0

精彩评论

暂无评论...
验证码 换一张
取 消