walidito wrote:
Hi everybody,
I'm trying to use both the struts-2 embedded ajax tags, I mean
<s:div id="once" theme="ajax" href="/TestAction.do" ...
And the real Dojo that I have downloaded from dojo's website.
Both work in a separate way, but If I try to use them both at the same time
it does'nt work anymore... Let me explain :
In my div tag, I redirect to an action (TestAction) that is redericted
itself to a jsp containing "real" dojo widgets, and then the events doesn't
work.
If your html references Dojo widgets, then it is a little more
complicated, the ajax hangman example in showcase does that, here is the
javascript from hangmanAjax.ftl:
dojo.io.bind({
url: "<@s.url
action="updateCharacterAvailable" namespace="/hangman/ajax" />",
load: function(type, data, event) {
var div =
dojo.byId("updateCharacterAvailableDiv");
destroyWidgets();
div.innerHTML = data;
try{
var xmlParser = new dojo.xml.Parse();
var frag =
xmlParser.parseElement(div, null, true);
//here Dojo creates the widget from
an xml...frag
dojo.widget.getParser().createComponents(frag);
// eval any scripts being returned
var scripts =
div.getElementsByTagName('script');
for (var i=0; i<scripts.length; i++) {
eval(scripts[i].innerHTML);
}
}
catch(e){
alert('dojo error '+e);
dojo.debug("auto-build-widgets
error: "+e);
}
},
mimetype: "text/html"
});
To fix it I have tried :
- to copy a working jsp with a dojo code inside . I mean a full jsp with a
head and body html tags, etc.
- to copy just a part of the working jsp, without head and body html tags,
etc. this looks like this :
<script type="text/javascript" src="../dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.io.*");
dojo.require("dojo.event.*");
...
I'm just wandering if it is really possible to add "real dojo" widgets to
struts 2. And if, Yes, if somenone could help, it would be great. thanks.
The easiest way is to add all the "dojo.require" to your main page, and
then use the code above to make the request and process the html
returned from your action and create the widgets.
musachy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]