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/21 12:01:08 UTC

Dojo bug?

Hello,

I have a very strange problem. I can´t specify if it is an Struts 2 
problem, a Javascript problem, a Dojo problem,...

The scenario is as follows:

I have a .jspx page like this:

<jsp:root xmlns="http://www.w3.org/1999/xhtml"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:s="/struts-tags"
    version="2.0">

<div id="source">
<s:url id="pruebaUrl" action="Prueba"/>
<s:a id="ojala" theme="ajax" href="${pruebaUrl}" indicator="indicator"
        loadingText=" " targets="workspaceAjaxContent">
    Try
</s:a>
</div>

<script language="JavaScript">
function aver() {
  var el = document.getElementById('tree');
  var aa = document.createElement("a");
  aa.setAttribute("dojoType", "struts:BindAnchor");
  aa.setAttribute("href", "/scheduler-admintool-1.0/Prueba.do");
  aa.setAttribute("loadingText", " ");
  aa.setAttribute("targets", "workspaceAjaxContent");
  aa.setAttribute("indicator", "indicator");
  aa.setAttribute("showError", "true");
  var textEl = document.createTextNode("pleaseeee");
  aa.appendChild(textEl);
  el.appendChild(aa);
}
</script>

<a href="javascript:void(0)" onclick="aver();">
    Create Link
</a>


<a showerror="true" indicator="indicator" targets="workspaceAjaxContent" 
loadingtext=" "
href="/scheduler-admintool-1.0/Prueba.do" 
dojotype="struts:BindAnchor">Try2</a>


<a dojotype="struts:BindAnchor" 
href="/scheduler-admintool-1.0/ShowUpdateProject.do" loadingtext=" "
    targets="workspaceAjaxContent" indicator="indicator" 
showerror="true">Update</a>

<div id="tree">

</div>

</jsp:root>


Why "Try", "Try2" and "Update" links work, but the generated one by 
"aver()" javascript function does not?? I mean, when "pleaseee" link is 
generated, if I click on it, the whole page is reloaded (that is, its 
href attribute is the whole action name 
"http://host:port/app/Prueba.do"), whereas in the other cases their 
hrefs are "#"...

Note "Try" is generated using struts tags, but "Try2" and "Update" are 
pure html, and they work too.

I have no idea about the solution. Any help would be very grateful.


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


Re: Dojo bug?

Posted by Pablo Vázquez Blázquez <pv...@denodo.com>.
Please, can anybody help me? I know it´s not pretty code, but it´s just 
a test to know what´s not working ok...





Pablo Vázquez Blázquez escribió:
> Hello,
>
> I have a very strange problem. I can´t specify if it is an Struts 2 
> problem, a Javascript problem, a Dojo problem,...
>
> The scenario is as follows:
>
> I have a .jspx page like this:
>
> <jsp:root xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:jsp="http://java.sun.com/JSP/Page"
>    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
>    xmlns:c="http://java.sun.com/jsp/jstl/core"
>    xmlns:s="/struts-tags"
>    version="2.0">
>
> <div id="source">
> <s:url id="pruebaUrl" action="Prueba"/>
> <s:a id="ojala" theme="ajax" href="${pruebaUrl}" indicator="indicator"
>        loadingText=" " targets="workspaceAjaxContent">
>    Try
> </s:a>
> </div>
>
> <script language="JavaScript">
> function aver() {
>  var el = document.getElementById('tree');
>  var aa = document.createElement("a");
>  aa.setAttribute("dojoType", "struts:BindAnchor");
>  aa.setAttribute("href", "/scheduler-admintool-1.0/Prueba.do");
>  aa.setAttribute("loadingText", " ");
>  aa.setAttribute("targets", "workspaceAjaxContent");
>  aa.setAttribute("indicator", "indicator");
>  aa.setAttribute("showError", "true");
>  var textEl = document.createTextNode("pleaseeee");
>  aa.appendChild(textEl);
>  el.appendChild(aa);
> }
> </script>
>
> <a href="javascript:void(0)" onclick="aver();">
>    Create Link
> </a>
>
>
> <a showerror="true" indicator="indicator" 
> targets="workspaceAjaxContent" loadingtext=" "
> href="/scheduler-admintool-1.0/Prueba.do" 
> dojotype="struts:BindAnchor">Try2</a>
>
>
> <a dojotype="struts:BindAnchor" 
> href="/scheduler-admintool-1.0/ShowUpdateProject.do" loadingtext=" "
>    targets="workspaceAjaxContent" indicator="indicator" 
> showerror="true">Update</a>
>
> <div id="tree">
>
> </div>
>
> </jsp:root>
>
>
> Why "Try", "Try2" and "Update" links work, but the generated one by 
> "aver()" javascript function does not?? I mean, when "pleaseee" link 
> is generated, if I click on it, the whole page is reloaded (that is, 
> its href attribute is the whole action name 
> "http://host:port/app/Prueba.do"), whereas in the other cases their 
> hrefs are "#"...
>
> Note "Try" is generated using struts tags, but "Try2" and "Update" are 
> pure html, and they work too.
>
> I have no idea about the solution. Any help would be very grateful.
>
>
> ---------------------------------------------------------------------
> 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