You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eduardo Kortright <ek...@gmail.com> on 2007/04/08 01:49:35 UTC

AJAX div loads local URL but not remote one

Hi all,

I'm trying to learn how to use AJAX, but I'm having some trouble.  In the
JSP below, the first <s:div/> loads the URL just fine, but the second
<s:div/> simply displays "Loading..." and stays that way forever.  IE
displays "Error on page" in the status bar when it is (apparently) trying to
contact the server, then "Done".  Is there anything that needs to be done
differently for a remote URL?

Thanks.

--
Eduardo


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib prefix="s" uri="/struts-tags" %>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Welcome</title>

<s:head theme="ajax"/>

</head>

<body>

<hr/>

<s:div theme="ajax" id="search" href="
http://localhost:8080/Struts2-tutorial1/">

Local page goes here.

</s:div>

<hr/>

<s:div theme="ajax" id="live365" href=http://www.google.com loadingText="Please
wait . . ." errorText="Sorry, can't load remote page">

Google page goes here.

</s:div>

<hr/>

</body>

</html>

Re: AJAX div loads local URL but not remote one

Posted by Musachy Barroso <mu...@gmail.com>.
This is not specific to the Struts ajax tags, HXR (ajax) calls can only be
done to the domain from where the page was loaded from. Dojo and other
frameworks use some neat tricks to get around this, but the Struts ajax tags
do not expose this Dojo functionality yet.

regards
musachy

On 4/9/07, Eduardo Kortright <ek...@gmail.com> wrote:
>
> Thanks.  Does that mean that the ajax tags allow only clients in the same
> domain as the server to communicate with the server?  Or does it mean that
> clients (in any domain) can communicate only with the server that served
> out
> the pages containing the ajax call?
>
> --
> Eduardo
>
>
> On 4/7/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > Dojo supports crossdomain XHR using IFrames, but the ajax tags do not
> > support it, yet.
> >
> > musachy
> >
> > On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
> > >
> > > Sorry about that... cut and paste went crazy on me; let me try
> > > again.  Here
> > > is the JSP again:
> > >
> > > <%@ page language="java" contentType="text/html;
> > > charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
> > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> > > http://www.w3.org/TR/html4/loose.dtd">
> > > <%@ taglib prefix="s" uri="/struts-tags" %>
> > > <html>
> > > <head>
> > > <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1">
> > > <title>Welcome</title>
> > > <s:head theme="ajax"/>
> > > </head>
> > > <body>
> > > <hr/>
> > > <s:div theme="ajax" id="search" href="
> > > http://localhost:8080/Struts2-tutorial1/">
> > >   Local page goes here.
> > > </s:div>
> > > <hr/>
> > > <s:div theme="ajax" id="live365" href="http://www.google.com"
> > >   loadingText="Please wait . . ." errorText="Sorry, can't load remote
> > > page">
> > >   Remote page goes here.
> > > </s:div>
> > > <hr/>
> > > </body>
> > > </html>
> > >
> > >
> > > On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > I'm trying to learn how to use AJAX, but I'm having some
> trouble.  In
> > > the
> > > > JSP below, the first <s:div/> loads the URL just fine, but the
> second
> > > > <s:div/> simply displays "Loading..." and stays that way
> forever.  IE
> > > > displays "Error on page" in the status bar when it is (apparently)
> > > trying to
> > > > contact the server, then "Done".  Is there anything that needs to be
> > > done
> > > > differently for a remote URL?
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > Eduardo
> > > >
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> Eduardo Kortright
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: AJAX div loads local URL but not remote one

Posted by Eduardo Kortright <ek...@gmail.com>.
Thanks.  Does that mean that the ajax tags allow only clients in the same
domain as the server to communicate with the server?  Or does it mean that
clients (in any domain) can communicate only with the server that served out
the pages containing the ajax call?

--
Eduardo


On 4/7/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> Dojo supports crossdomain XHR using IFrames, but the ajax tags do not
> support it, yet.
>
> musachy
>
> On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
> >
> > Sorry about that... cut and paste went crazy on me; let me try
> > again.  Here
> > is the JSP again:
> >
> > <%@ page language="java" contentType="text/html;
> > charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> > http://www.w3.org/TR/html4/loose.dtd">
> > <%@ taglib prefix="s" uri="/struts-tags" %>
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> > <title>Welcome</title>
> > <s:head theme="ajax"/>
> > </head>
> > <body>
> > <hr/>
> > <s:div theme="ajax" id="search" href="
> > http://localhost:8080/Struts2-tutorial1/">
> >   Local page goes here.
> > </s:div>
> > <hr/>
> > <s:div theme="ajax" id="live365" href="http://www.google.com"
> >   loadingText="Please wait . . ." errorText="Sorry, can't load remote
> > page">
> >   Remote page goes here.
> > </s:div>
> > <hr/>
> > </body>
> > </html>
> >
> >
> > On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
> > >
> > > Hi all,
> > >
> > > I'm trying to learn how to use AJAX, but I'm having some trouble.  In
> > the
> > > JSP below, the first <s:div/> loads the URL just fine, but the second
> > > <s:div/> simply displays "Loading..." and stays that way forever.  IE
> > > displays "Error on page" in the status bar when it is (apparently)
> > trying to
> > > contact the server, then "Done".  Is there anything that needs to be
> > done
> > > differently for a remote URL?
> > >
> > > Thanks.
> > >
> > > --
> > > Eduardo
> > >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
Eduardo Kortright

Re: AJAX div loads local URL but not remote one

Posted by Musachy Barroso <mu...@gmail.com>.
Dojo supports crossdomain XHR using IFrames, but the ajax tags do not
support it, yet.

musachy

On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
>
> Sorry about that... cut and paste went crazy on me; let me try
> again.  Here
> is the JSP again:
>
> <%@ page language="java" contentType="text/html;
> charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd">
> <%@ taglib prefix="s" uri="/struts-tags" %>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Welcome</title>
> <s:head theme="ajax"/>
> </head>
> <body>
> <hr/>
> <s:div theme="ajax" id="search" href="
> http://localhost:8080/Struts2-tutorial1/">
>   Local page goes here.
> </s:div>
> <hr/>
> <s:div theme="ajax" id="live365" href="http://www.google.com"
>   loadingText="Please wait . . ." errorText="Sorry, can't load remote
> page">
>   Remote page goes here.
> </s:div>
> <hr/>
> </body>
> </html>
>
>
> On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
> >
> > Hi all,
> >
> > I'm trying to learn how to use AJAX, but I'm having some trouble.  In
> the
> > JSP below, the first <s:div/> loads the URL just fine, but the second
> > <s:div/> simply displays "Loading..." and stays that way forever.  IE
> > displays "Error on page" in the status bar when it is (apparently)
> trying to
> > contact the server, then "Done".  Is there anything that needs to be
> done
> > differently for a remote URL?
> >
> > Thanks.
> >
> > --
> > Eduardo
> >
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: AJAX div loads local URL but not remote one

Posted by Eduardo Kortright <ek...@gmail.com>.
Sorry about that... cut and paste went crazy on me; let me try again.  Here
is the JSP again:

<%@ page language="java" contentType="text/html;
charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Welcome</title>
 <s:head theme="ajax"/>
</head>
<body>
 <hr/>
 <s:div theme="ajax" id="search" href="
http://localhost:8080/Struts2-tutorial1/">
  Local page goes here.
 </s:div>
 <hr/>
 <s:div theme="ajax" id="live365" href="http://www.google.com"
  loadingText="Please wait . . ." errorText="Sorry, can't load remote page">
  Remote page goes here.
 </s:div>
 <hr/>
</body>
</html>


On 4/7/07, Eduardo Kortright <ek...@gmail.com> wrote:
>
> Hi all,
>
> I'm trying to learn how to use AJAX, but I'm having some trouble.  In the
> JSP below, the first <s:div/> loads the URL just fine, but the second
> <s:div/> simply displays "Loading..." and stays that way forever.  IE
> displays "Error on page" in the status bar when it is (apparently) trying to
> contact the server, then "Done".  Is there anything that needs to be done
> differently for a remote URL?
>
> Thanks.
>
> --
> Eduardo
>