You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pablo Vázquez Blázquez <pv...@denodo.com> on 2007/09/20 17:35:45 UTC
Struts 2 + Dojo nightmare
Hi all,
I´ve been for two whole days treating with this issue, so I would be
very greateful if any help.
Well, I have a .jspx for my left tile of the page and then I have
another tile for the right side.
When the left side is loaded, it has 2 links:
- one called "Try". If I click this link, an ajax request in sent to
the server and the result is written in the rigth side of the page. OK.
***Here is the code***
<s:url id="pruebaUrl" action="Prueba"/>
<s:a theme="ajax" href="${pruebaUrl}" indicator="indicator"
loadingText=" " targets="workspaceAjaxContent">
Try
</s:a>
*** ***
- another one, called "Create link", which, once clicked, creates a
link to the same ajax action that before. Here, I made copy&paste of the
first link's html source-code to create a javascript function to achieve
this purpose. The problem is that this new generated link does NOT make
an ajax request to Prueba.do action, but it does a "normal" request to
"http://host:port/app-name/Prueba.do". So, if I have copied the
generated html for the first link, why this second one's behaviour is
different?
***Here is the code***
<script language="JavaScript">
<![CDATA[
function aver() {
var texto = "<a dojoType=\"struts:BindAnchor\" " +
"href=\"/scheduler-admintool-1.0/Prueba.do\"
loadingText=\" \" targets=\"workspaceAjaxContent\" " +
"indicator=\"indicator\" showError=\"true\">Prueba2</a>";
document.getElementById('tree').innerHTML = texto;
}
]]>
</script>
<a href="javascript:void(0)" onclick="javascript:aver();">
Create link
</a>
*** ***
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 + Dojo nightmare
Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
My main doubt is how dojo knows what to do in the first case (when I
just use the s:a tag) and why it does not know what to do in the second
case (when I copy the resultant html from the 1st case to create a new
link). Because the resultant html is the same in both cases...
Thank you in advanced.
Pablo Vázquez Blázquez escribió:
> If I just write your code, the new link is created similar to the
> other one, but when I click it nothing happens...
>
> Do I have to register some event in dojo or sth like this?
>
> Thank you very much.
>
> Alvaro Sanchez-Mariscal escribió:
>> Why not using dojo api to clone the node?
>> <div id="source">
>> <s:a theme="ajax" href="${pruebaUrl}" indicator="indicator"
>> loadingText=" " targets="workspaceAjaxContent">
>> Try
>> </s:a>
>> </div>
>>
>> ...
>>
>> <script type="text/javascript">
>> function aver() {
>> var sourceNode = dojo.byId('source');
>> var targetNode = dojo.byId('workspaceAjaxContent');
>>
>> dojo.dom.copyChildren(sourceNode, targetNode);
>> }
>> </script>
>>
>> If copyChildren does not fit to your requirements, take a look at the
>> dojo.dom api:
>>
>> http://dojo.inpdx.net/dojobox/trunk/api/#dojo.dom
>>
>> Un saludo,
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 + Dojo nightmare
Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
If I just write your code, the new link is created similar to the other
one, but when I click it nothing happens...
Do I have to register some event in dojo or sth like this?
Thank you very much.
Alvaro Sanchez-Mariscal escribió:
> Why not using dojo api to clone the node?
> <div id="source">
> <s:a theme="ajax" href="${pruebaUrl}" indicator="indicator"
> loadingText=" " targets="workspaceAjaxContent">
> Try
> </s:a>
> </div>
>
> ...
>
> <script type="text/javascript">
> function aver() {
> var sourceNode = dojo.byId('source');
> var targetNode = dojo.byId('workspaceAjaxContent');
>
> dojo.dom.copyChildren(sourceNode, targetNode);
> }
> </script>
>
> If copyChildren does not fit to your requirements, take a look at the
> dojo.dom api:
>
> http://dojo.inpdx.net/dojobox/trunk/api/#dojo.dom
>
> Un saludo,
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Struts 2 + Dojo nightmare
Posted by Alvaro Sanchez-Mariscal <al...@gmail.com>.
Why not using dojo api to clone the node?
<div id="source">
<s:a theme="ajax" href="${pruebaUrl}" indicator="indicator"
loadingText=" " targets="workspaceAjaxContent">
Try
</s:a>
</div>
...
<script type="text/javascript">
function aver() {
var sourceNode = dojo.byId('source');
var targetNode = dojo.byId('workspaceAjaxContent');
dojo.dom.copyChildren(sourceNode, targetNode);
}
</script>
If copyChildren does not fit to your requirements, take a look at the
dojo.dom api:
http://dojo.inpdx.net/dojobox/trunk/api/#dojo.dom
Un saludo,
--
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
alvaro.sanchezmariscal@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org