You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by hij <hi...@upb.de> on 2007/11/20 13:49:27 UTC

Refreshing of components within an iframe via PPR

Hi!

I’m using Trinidad 1.0.2.
I have a parent-jsf-page which contains an iframe and other components. The
iframe contains/refers to a child-jsf-page. 
 
Now here’s what I’d like to realize:
If a specific component on the parent-page is changed, another specific
component within the iframe shall be updated/refreshed via the PPR-feature.


    Example of my problem:
	the parent-jsf-page contains:
          -   inputText-component (is in a form; id is set;
autoSubmit-attribute is ‘true’)
          -   iframe-component contains:
                 -   outputText-component (partialTriggers-attribute
contains the id of the  
                                                       inputText-component)

        If the inputText-comp is changed, the outputText-comp shall be
refreshed via PPR. But it doesn’t 
        work.


So can anyone tell me how to refresh a specific component within an iframe
when a PPR-request is triggered by another specific component an the
parent-page via PPR ?

[And how works the whole thing vice versa: If I want a component on the
parent-page to refresh when a component within an iframe is changed?]

Thank you very much,
hij

-- 
View this message in context: http://www.nabble.com/Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13856259
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] Refreshing of components within an iframe via PPR

Posted by Gerhard Petracek <ge...@gmail.com>.
hello hij,

as i mentioned: it's an unaesthetic solution and:
> i'm not aware of a specific trinidad (out-of-the-box) feature which
provides a solution for this requirement.

sven already mentioned the challenge:
> "...because it can be theoretical possible that the site is hosted on a
different server..."

in such a case you would violate the same-origin policy - see e.g.:
http://www.devarticles.com/c/a/JavaScript/JavaScript-Security/

if there are no further suggestions for a really nice solution i would say -
that are your possibilities to solve the problem (even though they aren't
awesome)

regards,
gerhard



2007/11/27, hij <hi...@upb.de>:
>
>
> Hi!
>
> Thank you very much for the replies.
> I have tried out the suggestions and they work.
>
> But I have thought there is a more elegant solution.
>
> Do you perhaps still have another suggestion?
>
> Thank you very much,
> hij
>
>
> Gerhard Petracek wrote:
> >
> > hello,
> >
> > first of all - i've never tried it - so i'm not sure about my
> suggestion.
> >
> > i'm not aware of a specific trinidad (out-of-the-box) feature which
> > provides
> > a solution for this requirement. it's more a general challenge.
> >
> > as sven mentioned you can update the whole iframe.
> >
> > however, theoretically if the webapps are hosted on the same server an
> > other
> > (unaesthetic) possibility should be:
> >
> > you can hide e.g. a ppr enabled button within the "child-jsf-page" which
> > triggers a ppr-request (to update only specific components).
> > within the "parent-jsf-page" you place (and call) a javascript which
> > resolves this hidden button and afterwards you call .click() on it.
> > if this would work you don't have to refresh the whole iframe. however,
> > there is some really unaesthetic handwork.
> >
> > if you choose this second suggestion - it would be great to get feedback
> > (if
> > it works or not) and maybe you can provide the implemented solution for
> > the
> > archives (if it works).
> >
> > regards,
> > gerhard
> >
> >
> >
> > 2007/11/26, Rottstock, Sven <Sv...@sungard.de>:
> >>
> >> Hi,
> >>
> >> i think you cannot update single components in an iframe because it can
> >> be
> >> theoretical possible that the site is hosted on a different server or
> >> comes
> >> from a different session. But you can update the whole iframe with
> >> JavaScript if you like. Here is a short example:
> >>
> >> <!-- submit should trigger the JavaScript -->
> >> <tr:inputText autoSubmit="true" id="inputComp" value="#{bean.text}"
> >> label="InputText:"/>
> >>
> >> <iframe id="embeddedComp" frameborder="0" marginheight="0"
> >>   marginwidth="0" scrolling="auto" src="/embeddedComp.faces"
> >> align="middle"
> >>   height="100%" width="100%"/>
> >>
> >> <!-- re-render the iframe -->
> >> <trh:script id="script-embeddedCompRefresh"
> >>   text="var embeddedComp = document.getElementById('embeddedComp');
> >> embeddedComp.src='/embeddedComp.faces';"
> >>   partialTriggers="inputComp" />
> >>
> >> Hope this will help you...
> >>
> >> Regards
> >> Sven
> >>
> >> -----Ursprüngliche Nachricht-----
> >> Von: hij [mailto:hijub04@upb.de]
> >> Gesendet: Sonntag, 25. November 2007 16:14
> >> An: users@myfaces.apache.org
> >> Betreff: Re: [Trinidad] Refreshing of components within an iframe via
> PPR
> >>
> >>
> >> Can nobody help me?
> >> Can I realize that with Trinidad?
> >>
> >>
> >> Thanks,
> >> hij
> >>
> >>
> >>
> >> hij wrote:
> >> >
> >> > Hi!
> >> >
> >> > I'm using Trinidad 1.0.2.
> >> > I have a parent-jsf-page which contains an iframe and other
> components.
> >> > The iframe contains/refers to a child-jsf-page.
> >> >
> >> > Now here's what I'd like to realize:
> >> > If a specific component on the parent-page is changed, another
> >> > specific component within the iframe shall be updated/refreshed via
> >> > the PPR-feature.
> >> >
> >> >
> >> >     Example of my problem:
> >> >       the parent-jsf-page contains:
> >> >           -   inputText-component (is in a form; id is set;
> >> > autoSubmit-attribute is 'true')
> >> >           -   iframe-component contains:
> >> >                  -   outputText-component (partialTriggers-attribute
> >> > contains the id of the
> >> >
> >> > inputText-component)
> >> >
> >> >         If the inputText-comp is changed, the outputText-comp shall
> be
> >> > refreshed via PPR. But it doesn't
> >> >         work.
> >> >
> >> >
> >> > So can anyone tell me how to refresh a specific component within an
> >> > iframe when a PPR-request is triggered by another specific component
> >> > an the parent-page via PPR ?
> >> >
> >> > [And how works the whole thing vice versa: If I want a component on
> >> > the parent-page to refresh when a component within an iframe is
> >> > changed?]
> >> >
> >> > Thank you very much,
> >> > hij
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13936462
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13968180
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: [Trinidad] Refreshing of components within an iframe via PPR

Posted by hij <hi...@upb.de>.
Hi!

Thank you very much for the replies.
I have tried out the suggestions and they work.

But I have thought there is a more elegant solution.

Do you perhaps still have another suggestion?

Thank you very much,
hij


Gerhard Petracek wrote:
> 
> hello,
> 
> first of all - i've never tried it - so i'm not sure about my suggestion.
> 
> i'm not aware of a specific trinidad (out-of-the-box) feature which
> provides
> a solution for this requirement. it's more a general challenge.
> 
> as sven mentioned you can update the whole iframe.
> 
> however, theoretically if the webapps are hosted on the same server an
> other
> (unaesthetic) possibility should be:
> 
> you can hide e.g. a ppr enabled button within the "child-jsf-page" which
> triggers a ppr-request (to update only specific components).
> within the "parent-jsf-page" you place (and call) a javascript which
> resolves this hidden button and afterwards you call .click() on it.
> if this would work you don't have to refresh the whole iframe. however,
> there is some really unaesthetic handwork.
> 
> if you choose this second suggestion - it would be great to get feedback
> (if
> it works or not) and maybe you can provide the implemented solution for
> the
> archives (if it works).
> 
> regards,
> gerhard
> 
> 
> 
> 2007/11/26, Rottstock, Sven <Sv...@sungard.de>:
>>
>> Hi,
>>
>> i think you cannot update single components in an iframe because it can
>> be
>> theoretical possible that the site is hosted on a different server or
>> comes
>> from a different session. But you can update the whole iframe with
>> JavaScript if you like. Here is a short example:
>>
>> <!-- submit should trigger the JavaScript -->
>> <tr:inputText autoSubmit="true" id="inputComp" value="#{bean.text}"
>> label="InputText:"/>
>>
>> <iframe id="embeddedComp" frameborder="0" marginheight="0"
>>   marginwidth="0" scrolling="auto" src="/embeddedComp.faces"
>> align="middle"
>>   height="100%" width="100%"/>
>>
>> <!-- re-render the iframe -->
>> <trh:script id="script-embeddedCompRefresh"
>>   text="var embeddedComp = document.getElementById('embeddedComp');
>> embeddedComp.src='/embeddedComp.faces';"
>>   partialTriggers="inputComp" />
>>
>> Hope this will help you...
>>
>> Regards
>> Sven
>>
>> -----Ursprüngliche Nachricht-----
>> Von: hij [mailto:hijub04@upb.de]
>> Gesendet: Sonntag, 25. November 2007 16:14
>> An: users@myfaces.apache.org
>> Betreff: Re: [Trinidad] Refreshing of components within an iframe via PPR
>>
>>
>> Can nobody help me?
>> Can I realize that with Trinidad?
>>
>>
>> Thanks,
>> hij
>>
>>
>>
>> hij wrote:
>> >
>> > Hi!
>> >
>> > I'm using Trinidad 1.0.2.
>> > I have a parent-jsf-page which contains an iframe and other components.
>> > The iframe contains/refers to a child-jsf-page.
>> >
>> > Now here's what I'd like to realize:
>> > If a specific component on the parent-page is changed, another
>> > specific component within the iframe shall be updated/refreshed via
>> > the PPR-feature.
>> >
>> >
>> >     Example of my problem:
>> >       the parent-jsf-page contains:
>> >           -   inputText-component (is in a form; id is set;
>> > autoSubmit-attribute is 'true')
>> >           -   iframe-component contains:
>> >                  -   outputText-component (partialTriggers-attribute
>> > contains the id of the
>> >
>> > inputText-component)
>> >
>> >         If the inputText-comp is changed, the outputText-comp shall be
>> > refreshed via PPR. But it doesn't
>> >         work.
>> >
>> >
>> > So can anyone tell me how to refresh a specific component within an
>> > iframe when a PPR-request is triggered by another specific component
>> > an the parent-page via PPR ?
>> >
>> > [And how works the whole thing vice versa: If I want a component on
>> > the parent-page to refresh when a component within an iframe is
>> > changed?]
>> >
>> > Thank you very much,
>> > hij
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13936462
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13968180
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] Refreshing of components within an iframe via PPR

Posted by Gerhard Petracek <ge...@gmail.com>.
hello,

first of all - i've never tried it - so i'm not sure about my suggestion.

i'm not aware of a specific trinidad (out-of-the-box) feature which provides
a solution for this requirement. it's more a general challenge.

as sven mentioned you can update the whole iframe.

however, theoretically if the webapps are hosted on the same server an other
(unaesthetic) possibility should be:

you can hide e.g. a ppr enabled button within the "child-jsf-page" which
triggers a ppr-request (to update only specific components).
within the "parent-jsf-page" you place (and call) a javascript which
resolves this hidden button and afterwards you call .click() on it.
if this would work you don't have to refresh the whole iframe. however,
there is some really unaesthetic handwork.

if you choose this second suggestion - it would be great to get feedback (if
it works or not) and maybe you can provide the implemented solution for the
archives (if it works).

regards,
gerhard



2007/11/26, Rottstock, Sven <Sv...@sungard.de>:
>
> Hi,
>
> i think you cannot update single components in an iframe because it can be
> theoretical possible that the site is hosted on a different server or comes
> from a different session. But you can update the whole iframe with
> JavaScript if you like. Here is a short example:
>
> <!-- submit should trigger the JavaScript -->
> <tr:inputText autoSubmit="true" id="inputComp" value="#{bean.text}"
> label="InputText:"/>
>
> <iframe id="embeddedComp" frameborder="0" marginheight="0"
>   marginwidth="0" scrolling="auto" src="/embeddedComp.faces"
> align="middle"
>   height="100%" width="100%"/>
>
> <!-- re-render the iframe -->
> <trh:script id="script-embeddedCompRefresh"
>   text="var embeddedComp = document.getElementById('embeddedComp');
> embeddedComp.src='/embeddedComp.faces';"
>   partialTriggers="inputComp" />
>
> Hope this will help you...
>
> Regards
> Sven
>
> -----Ursprüngliche Nachricht-----
> Von: hij [mailto:hijub04@upb.de]
> Gesendet: Sonntag, 25. November 2007 16:14
> An: users@myfaces.apache.org
> Betreff: Re: [Trinidad] Refreshing of components within an iframe via PPR
>
>
> Can nobody help me?
> Can I realize that with Trinidad?
>
>
> Thanks,
> hij
>
>
>
> hij wrote:
> >
> > Hi!
> >
> > I'm using Trinidad 1.0.2.
> > I have a parent-jsf-page which contains an iframe and other components.
> > The iframe contains/refers to a child-jsf-page.
> >
> > Now here's what I'd like to realize:
> > If a specific component on the parent-page is changed, another
> > specific component within the iframe shall be updated/refreshed via
> > the PPR-feature.
> >
> >
> >     Example of my problem:
> >       the parent-jsf-page contains:
> >           -   inputText-component (is in a form; id is set;
> > autoSubmit-attribute is 'true')
> >           -   iframe-component contains:
> >                  -   outputText-component (partialTriggers-attribute
> > contains the id of the
> >
> > inputText-component)
> >
> >         If the inputText-comp is changed, the outputText-comp shall be
> > refreshed via PPR. But it doesn't
> >         work.
> >
> >
> > So can anyone tell me how to refresh a specific component within an
> > iframe when a PPR-request is triggered by another specific component
> > an the parent-page via PPR ?
> >
> > [And how works the whole thing vice versa: If I want a component on
> > the parent-page to refresh when a component within an iframe is
> > changed?]
> >
> > Thank you very much,
> > hij
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13936462
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

AW: [Trinidad] Refreshing of components within an iframe via PPR

Posted by "Rottstock, Sven" <Sv...@sungard.de>.
Hi,

i think you cannot update single components in an iframe because it can be theoretical possible that the site is hosted on a different server or comes from a different session. But you can update the whole iframe with JavaScript if you like. Here is a short example:

<!-- submit should trigger the JavaScript -->
<tr:inputText autoSubmit="true" id="inputComp" value="#{bean.text}" label="InputText:"/>

<iframe id="embeddedComp" frameborder="0" marginheight="0"
  marginwidth="0" scrolling="auto" src="/embeddedComp.faces" align="middle"
  height="100%" width="100%"/>

<!-- re-render the iframe -->
<trh:script id="script-embeddedCompRefresh" 
  text="var embeddedComp = document.getElementById('embeddedComp'); embeddedComp.src='/embeddedComp.faces';"
  partialTriggers="inputComp" />

Hope this will help you...

Regards
Sven

-----Ursprüngliche Nachricht-----
Von: hij [mailto:hijub04@upb.de] 
Gesendet: Sonntag, 25. November 2007 16:14
An: users@myfaces.apache.org
Betreff: Re: [Trinidad] Refreshing of components within an iframe via PPR


Can nobody help me?
Can I realize that with Trinidad?


Thanks,
hij



hij wrote:
> 
> Hi!
> 
> I'm using Trinidad 1.0.2.
> I have a parent-jsf-page which contains an iframe and other components.
> The iframe contains/refers to a child-jsf-page. 
>  
> Now here's what I'd like to realize:
> If a specific component on the parent-page is changed, another 
> specific component within the iframe shall be updated/refreshed via 
> the PPR-feature.
> 
> 
>     Example of my problem:
> 	the parent-jsf-page contains:
>           -   inputText-component (is in a form; id is set;
> autoSubmit-attribute is 'true')
>           -   iframe-component contains:
>                  -   outputText-component (partialTriggers-attribute
> contains the id of the
>                                                       
> inputText-component)
> 
>         If the inputText-comp is changed, the outputText-comp shall be 
> refreshed via PPR. But it doesn't
>         work.
> 
> 
> So can anyone tell me how to refresh a specific component within an 
> iframe when a PPR-request is triggered by another specific component 
> an the parent-page via PPR ?
> 
> [And how works the whole thing vice versa: If I want a component on 
> the parent-page to refresh when a component within an iframe is 
> changed?]
> 
> Thank you very much,
> hij
> 
> 

--
View this message in context: http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13936462
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: [Trinidad] Refreshing of components within an iframe via PPR

Posted by hij <hi...@upb.de>.
Can nobody help me?
Can I realize that with Trinidad?


Thanks,
hij



hij wrote:
> 
> Hi!
> 
> I’m using Trinidad 1.0.2.
> I have a parent-jsf-page which contains an iframe and other components.
> The iframe contains/refers to a child-jsf-page. 
>  
> Now here’s what I’d like to realize:
> If a specific component on the parent-page is changed, another specific
> component within the iframe shall be updated/refreshed via the
> PPR-feature.
> 
> 
>     Example of my problem:
> 	the parent-jsf-page contains:
>           -   inputText-component (is in a form; id is set;
> autoSubmit-attribute is ‘true’)
>           -   iframe-component contains:
>                  -   outputText-component (partialTriggers-attribute
> contains the id of the  
>                                                       
> inputText-component)
> 
>         If the inputText-comp is changed, the outputText-comp shall be
> refreshed via PPR. But it doesn’t 
>         work.
> 
> 
> So can anyone tell me how to refresh a specific component within an iframe
> when a PPR-request is triggered by another specific component an the
> parent-page via PPR ?
> 
> [And how works the whole thing vice versa: If I want a component on the
> parent-page to refresh when a component within an iframe is changed?]
> 
> Thank you very much,
> hij
> 
> 

-- 
View this message in context: http://www.nabble.com/-Trinidad--Refreshing-of-components-within-an-iframe-via-PPR-tf4843264.html#a13936462
Sent from the MyFaces - Users mailing list archive at Nabble.com.