You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lucas Garcia <lu...@gmail.com> on 2007/06/13 11:03:12 UTC

[S2] Problems with ajax anchor tag

Hi,

I'm testing the ajax Anchor tag (
http://struts.apache.org/2.x/docs/ajax-tags.html#AjaxTags-anchorTag). Mi jsp
page looks like:


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title><s:text name="Home.title"/></title>
    <s:head theme="ajax" />
    <link rel="shortcut icon" href="favicon.ico" />
</head>
<body>

<s:div theme="ajax" id="div1">Div 1</s:div>

<s:url id="ajaxTest" value="/AjaxTest" />
<s:a id="link1" theme="ajax" href="%{ajaxTest}" targets="div1">Update
divs</s:a>

</body>
</html>

The AjaxTest action returns a "Hello" content, but when I click in the link,
the page is reloaded and the browser displays only a "Hello" page instead of
the div1 div with the new content and the link1 link.

What I'm doing wrong? (I'm working with Struts 2.0.6)

Re: [S2] Problems with ajax anchor tag

Posted by Lucas Garcia <lu...@gmail.com>.
Hi,

I believe I've found the problem origin. I'm working without
action-extension (my url looks like www.blablabla.com/Home instead of
Home.action or Home.do). For this reason, when ajax theme constructs
/struts/dojo/dojo.js call dinamically, struts try to manage .js files as
actions (returning an error).

 Now, the question is: how can I do to work without action-extension and
make struts to serve .js files?

Otherwise, the .js files have strange path in the dinamic calls in the pages
(i.e. /struts/dojo/dojo.js, /struts/simple/dojoRequire.js), that's different
from the path they have in the struts-core.jar. It's a good idea to
extract .js files from the struts.core.jar? Where to put them?

Cheers

On 6/13/07, Lucas Garcia <lu...@gmail.com> wrote:
>
> Hi,
>
> I'm testing the ajax Anchor tag (
> http://struts.apache.org/2.x/docs/ajax-tags.html#AjaxTags-anchorTag). Mi
> jsp page looks like:
>
>
> <%@ page contentType="text/html; charset=UTF-8" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns=" http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
>     <title><s:text name="Home.title"/></title>
>     <s:head theme="ajax" />
>     <link rel="shortcut icon" href="favicon.ico" />
> </head>
> <body>
>
> <s:div theme="ajax" id="div1">Div 1</s:div>
>
> <s:url id="ajaxTest" value="/AjaxTest" />
> <s:a id="link1" theme="ajax" href="%{ajaxTest}" targets="div1">Update
> divs</s:a>
>
> </body>
> </html>
>
> The AjaxTest action returns a "Hello" content, but when I click in the
> link, the page is reloaded and the browser displays only a "Hello" page
> instead of the div1 div with the new content and the link1 link.
>
> What I'm doing wrong? (I'm working with Struts 2.0.6)
>
>
>