incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Böhringer Jochen <Jochen.Boehrin...@tcc-products.de>
Subject AW: Trinidad: How does PPR replace content in the dom?
Date Fri, 08 Dec 2006 09:09:45 GMT
Thanks a lot! This made it work:

writer.writeAttribute("defer", Boolean.TRUE, null);

In my code I had

writer.writeAttribute("defer", "true", null);

which didn't work...

Now it works in Firefox without any JavaScript errors. In IE I get a strange error located
inside the dojo Javascript sources. So I have to dig deeper in the dojo sources. But anyway
your hint brought me a great step further!

Regards
Jochen

-----Ursprüngliche Nachricht-----
Von: Adam Winer [mailto:awiner@gmail.com] 
Gesendet: Freitag, 8. Dezember 2006 05:01
An: adffaces-dev@incubator.apache.org
Cc: adffaces-user@incubator.apache.org
Betreff: Re: Trinidad: How does PPR replace content in the dom?

On 12/7/06, Böhringer Jochen <Jochen.Boehringer@tcc-products.de> wrote:
> Hello,
>
> how does PPR replace content in the dom of the page. I know that PPR uses an IFrame.
But how is the data loaded into the IFrame copied into the main page?
>
> I guess it could be realized this way:
>
> 1.) Load new HTML markup into the IFrame.
> 2.) Copy the new markup in the Iframe to the main Frame using .innerHtml

Roughly speaking, yes, though it's a lot more complicated than that.

>
> Am I right or is it done using another mechanism? If I'm right and I have a component
whose renderer generates markup containing <script>alert('Test');</script>
>
> This scriptlet would first be executed after loaded into the iframe. And would be executed
a second time if the ppr mechanism has copied it into the main frame. Is this correct?

No, it's actually more clever than that - as long as you write out the
script element using ResponseWriter.startElement.  My memory's gotten
a little fuzy on the details - you may
also need to call writeAttribute("defer", Boolean.TRUE, null).  But,
at any rate, the script
is blocked for execution in the iframe, then executed in the main page.

When I get the chance to rewrite the code to use XMLHttp instead of an iframe,
this gets a bit easier in some ways (a bit harder in others).

-- Adam


> If yes, how can I generate a javascript in a renderer which is called after the markup
is copied into the mainframe and not in the iframe? Is there a special trick I can use in
a component using PPR capabilities? I would like to do it the Trinidad way, because I would
like to donate my DragAndDrop component (as soon as it works) back to Trinidad.
>
> Regards
> Jochen
>

Mime
View raw message