You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Laurie Harper <la...@holoweb.net> on 2006/08/24 03:22:14 UTC

Dialogs loading in popup *and* parent window

I'm trying to get Trinidad dialogs working in an application and it's  
almost working, with one caveat: when a dialog opens, a new window  
pops up as expected, with the correct page displayed, but the calling  
window *also* refreshes to display the dialog -- in other words, I  
end up with the dialog displayed in both the popup window and the  
originating window.

I have a somewhat involved configuration, using custom ViewHandler  
and NavigationHandler implementations, with Shale, Facelets, Trinidad  
and MyFaces all in the mix, so it's probably some undesired  
interaction between one or more of these components that's causing  
the problem. The trouble is, I'm not quite sure where to start  
looking...

Since the correct dialog *is* opening in a new window, I suspect that  
the undesired refresh of the originating window is due to a mis-step  
somewhere in the dialog handling on the client side. Here's a simple- 
as-possible Facelets view to invoke a dialog:

dialog.xhtml
------------
<tr:document xmlns="http://www.w3.org/1999/xhtml" xmlns:tr="http:// 
myfaces.apache.org/trinidad">
     <tr:form>
         <h1>Launch a dialog</h1>
         <tr:commandLink action="popup:edit" useWindow="true">edit</ 
tr:commandLink>
     </tr:form>
</tr:document>

faces-config.xml
----------------
...
     <navigation-rule>
         <from-view-id>/foo/dialog.xhtml</from-view-id>
         <navigation-case>
             <from-outcome>popup:edit</from-outcome>
             <to-view-id>/foo/dialog2.xhtml</to-view-id>
         </navigation-case>
     </navigation-rule>
...

The rendered HTML from dialog.xhtml is included below. I can see that  
the command link calls submitForm() on click, and tracing through  
that with Venkman shows that it eventually calls form.submit(). What  
I'm unclear about is how/where the response gets redirected to a  
popup window, and how it's getting rendered in the originating window  
*as well as* in the popup window.

I'm using a recent Trinidad build from svn trunk. Any suggestions for  
how to further diagnose this would be *most* welcome...

L.


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ 
TR/html4/loose.dtd">
<html dir="ltr" lang="en">
<head>
<meta name="generator" content="Oracle ADF Faces">
<link rel="stylesheet" charset="UTF-8" type="text/css" href="/adf/ 
styles/cache/minimal-desktop-${version}-en-gecko.css">
<script>var _AdfWindowOpenError='A popup window blocker has been  
detected in your browser. Popup blockers interfere with the operation  
of this application. Please disable your popup blocker or allow  
popups from this site.';</script>
<script src="/adf/jsLibs/Common11-m7.js"></script>
<script>_defaultTZ()</script>
</head>
<body onload="_checkLoad(event)" onunload="_checkUnload(event)">
<iframe id="_pprIFrame" name="_pprIFrame" frameborder="0"  
longdesc="#" title="" src="about:blank"  
style="position:absolute;top:-100px;visibility:hidden" width="0"  
height="0"></iframe>
<div id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"  
style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"  
onkeydown="return false;" onkeyup="return false;" onmousedown="return  
false;" onmouseup="return false;" onkeypress="return false;"></div>
<script>var _cachedLibs;</script>
<a name="top"></a>
<noscript>This page uses JavaScript and requires a JavaScript enabled  
browser.Your browser is not JavaScript enabled.</noscript>
<form id="_id2" name="_id2" style="margin:0px" method="POST"  
onkeypress="return _submitOnEnter(event,'_id2');" action="/faces/foo/ 
dialog.xhtml">
         <h1>Launch a dialog</h1>
         <a onclick="submitForm('_id2',1,{source:'_id4'});return  
false;" class="xi" href="#">edit</a>
         <input type="hidden"  
name="org.apache.myfaces.trinidad.faces.FORM" value="_id2">
         <span id="__id2_Postscript">
                 <input type="hidden"  
name="org.apache.myfaces.trinidad.faces.STATE" value="!-47b9b9a5">
                 <input type="hidden" name="source">
                 <script>var _reset_id2Names=["source"];</script>
                 <script>function __id2Validator(){return true;}var  
_id2_SF={};</script>
         </span>
         <script>_submitFormCheck();</script>
</form>
</body>
<!-- Created by Oracle ADF Faces (Version unknown: ADF Faces API - ??/ 
ADF Faces Implementation - ??), skin:minimal.desktop (minimal) -->
</html>


--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/




Re: Dialogs loading in popup *and* parent window

Posted by Adam Winer <aw...@gmail.com>.
Laurie,

Seeing this one way after the fact.  This seems like a pretty bad bug;
partialSubmit="true" is a good idea, but definitely shouldn't be
necessary...  I think something is going very wrong here, and I'll
look into it.

-- Adam



On 8/23/06, Laurie Harper <la...@holoweb.net> wrote:
>
> Setting partialSubmit="true" fixes it, thanks! Now the question is,
> should that be necessary, or should Trinidad somehow figure it out
> automatically? And if that's not possible, what are the circumstances
> where it needs to be specified? where it can be omitted?
>
> Cheers,
>
> L.
>
> On 23-Aug-06, at 11:32 PM, Matthias Wessendorf wrote:
>
> > I am using also
> > Shale, Facelets and Trinidad
> >
> > no issue here
> > try to add
> > partialSubmit="true" immediate="true"
> >
> >
> >     <tr:commandButton id="button2" text="No Account?"
> > action="#{dialogBean.createAccount}"
> >     returnListener="#{dialogBean.returned}" partialSubmit="true"
> > immediate="true" useWindow="true" windowWidth="400"
> > windowHeight="400"/>
> >
> >
> > On 8/23/06, Laurie Harper <la...@holoweb.net> wrote:
> >> I'm trying to get Trinidad dialogs working in an application and it's
> >> almost working, with one caveat: when a dialog opens, a new window
> >> pops up as expected, with the correct page displayed, but the calling
> >> window *also* refreshes to display the dialog -- in other words, I
> >> end up with the dialog displayed in both the popup window and the
> >> originating window.
> >>
> >> I have a somewhat involved configuration, using custom ViewHandler
> >> and NavigationHandler implementations, with Shale, Facelets, Trinidad
> >> and MyFaces all in the mix, so it's probably some undesired
> >> interaction between one or more of these components that's causing
> >> the problem. The trouble is, I'm not quite sure where to start
> >> looking...
> >>
> >> Since the correct dialog *is* opening in a new window, I suspect that
> >> the undesired refresh of the originating window is due to a mis-step
> >> somewhere in the dialog handling on the client side. Here's a simple-
> >> as-possible Facelets view to invoke a dialog:
> >>
> >> dialog.xhtml
> >> ------------
> >> <tr:document xmlns="http://www.w3.org/1999/xhtml" xmlns:tr="http://
> >> myfaces.apache.org/trinidad">
> >>      <tr:form>
> >>          <h1>Launch a dialog</h1>
> >>          <tr:commandLink action="popup:edit" useWindow="true">edit</
> >> tr:commandLink>
> >>      </tr:form>
> >> </tr:document>
> >>
> >> faces-config.xml
> >> ----------------
> >> ...
> >>      <navigation-rule>
> >>          <from-view-id>/foo/dialog.xhtml</from-view-id>
> >>          <navigation-case>
> >>              <from-outcome>popup:edit</from-outcome>
> >>              <to-view-id>/foo/dialog2.xhtml</to-view-id>
> >>          </navigation-case>
> >>      </navigation-rule>
> >> ...
> >>
> >> The rendered HTML from dialog.xhtml is included below. I can see that
> >> the command link calls submitForm() on click, and tracing through
> >> that with Venkman shows that it eventually calls form.submit(). What
> >> I'm unclear about is how/where the response gets redirected to a
> >> popup window, and how it's getting rendered in the originating window
> >> *as well as* in the popup window.
> >>
> >> I'm using a recent Trinidad build from svn trunk. Any suggestions for
> >> how to further diagnose this would be *most* welcome...
> >>
> >> L.
> >>
> >>
> >> <?xml version='1.0' encoding='UTF-8'?>
> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> >> TR/html4/loose.dtd">
> >> <html dir="ltr" lang="en">
> >> <head>
> >> <meta name="generator" content="Oracle ADF Faces">
> >> <link rel="stylesheet" charset="UTF-8" type="text/css" href="/adf/
> >> styles/cache/minimal-desktop-${version}-en-gecko.css">
> >> <script>var _AdfWindowOpenError='A popup window blocker has been
> >> detected in your browser. Popup blockers interfere with the operation
> >> of this application. Please disable your popup blocker or allow
> >> popups from this site.';</script>
> >> <script src="/adf/jsLibs/Common11-m7.js"></script>
> >> <script>_defaultTZ()</script>
> >> </head>
> >> <body onload="_checkLoad(event)" onunload="_checkUnload(event)">
> >> <iframe id="_pprIFrame" name="_pprIFrame" frameborder="0"
> >> longdesc="#" title="" src="about:blank"
> >> style="position:absolute;top:-100px;visibility:hidden" width="0"
> >> height="0"></iframe>
> >> <div id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"
> >> style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"
> >> onkeydown="return false;" onkeyup="return false;" onmousedown="return
> >> false;" onmouseup="return false;" onkeypress="return false;"></div>
> >> <script>var _cachedLibs;</script>
> >> <a name="top"></a>
> >> <noscript>This page uses JavaScript and requires a JavaScript enabled
> >> browser.Your browser is not JavaScript enabled.</noscript>
> >> <form id="_id2" name="_id2" style="margin:0px" method="POST"
> >> onkeypress="return _submitOnEnter(event,'_id2');" action="/faces/foo/
> >> dialog.xhtml">
> >>          <h1>Launch a dialog</h1>
> >>          <a onclick="submitForm('_id2',1,{source:'_id4'});return
> >> false;" class="xi" href="#">edit</a>
> >>          <input type="hidden"
> >> name="org.apache.myfaces.trinidad.faces.FORM" value="_id2">
> >>          <span id="__id2_Postscript">
> >>                  <input type="hidden"
> >> name="org.apache.myfaces.trinidad.faces.STATE" value="!-47b9b9a5">
> >>                  <input type="hidden" name="source">
> >>                  <script>var _reset_id2Names=["source"];</script>
> >>                  <script>function __id2Validator(){return true;}var
> >> _id2_SF={};</script>
> >>          </span>
> >>          <script>_submitFormCheck();</script>
> >> </form>
> >> </body>
> >> <!-- Created by Oracle ADF Faces (Version unknown: ADF Faces API
> >> - ??/
> >> ADF Faces Implementation - ??), skin:minimal.desktop (minimal) -->
> >> </html>
> >>
> >>
> >> --
> >> Laurie Harper
> >> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> >> Founder, Zotech Software: http://www.zotechsoftware.com/
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Matthias Wessendorf
> >
> > further stuff:
> > blog: http://jroller.com/page/mwessendorf
> > mail: mwessendorf-at-gmail-dot-com
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
>

Re: Dialogs loading in popup *and* parent window

Posted by Laurie Harper <la...@holoweb.net>.
Setting partialSubmit="true" fixes it, thanks! Now the question is,  
should that be necessary, or should Trinidad somehow figure it out  
automatically? And if that's not possible, what are the circumstances  
where it needs to be specified? where it can be omitted?

Cheers,

L.

On 23-Aug-06, at 11:32 PM, Matthias Wessendorf wrote:

> I am using also
> Shale, Facelets and Trinidad
>
> no issue here
> try to add
> partialSubmit="true" immediate="true"
>
>
>     <tr:commandButton id="button2" text="No Account?"
> action="#{dialogBean.createAccount}"
>     returnListener="#{dialogBean.returned}" partialSubmit="true"
> immediate="true" useWindow="true" windowWidth="400"
> windowHeight="400"/>
>
>
> On 8/23/06, Laurie Harper <la...@holoweb.net> wrote:
>> I'm trying to get Trinidad dialogs working in an application and it's
>> almost working, with one caveat: when a dialog opens, a new window
>> pops up as expected, with the correct page displayed, but the calling
>> window *also* refreshes to display the dialog -- in other words, I
>> end up with the dialog displayed in both the popup window and the
>> originating window.
>>
>> I have a somewhat involved configuration, using custom ViewHandler
>> and NavigationHandler implementations, with Shale, Facelets, Trinidad
>> and MyFaces all in the mix, so it's probably some undesired
>> interaction between one or more of these components that's causing
>> the problem. The trouble is, I'm not quite sure where to start
>> looking...
>>
>> Since the correct dialog *is* opening in a new window, I suspect that
>> the undesired refresh of the originating window is due to a mis-step
>> somewhere in the dialog handling on the client side. Here's a simple-
>> as-possible Facelets view to invoke a dialog:
>>
>> dialog.xhtml
>> ------------
>> <tr:document xmlns="http://www.w3.org/1999/xhtml" xmlns:tr="http://
>> myfaces.apache.org/trinidad">
>>      <tr:form>
>>          <h1>Launch a dialog</h1>
>>          <tr:commandLink action="popup:edit" useWindow="true">edit</
>> tr:commandLink>
>>      </tr:form>
>> </tr:document>
>>
>> faces-config.xml
>> ----------------
>> ...
>>      <navigation-rule>
>>          <from-view-id>/foo/dialog.xhtml</from-view-id>
>>          <navigation-case>
>>              <from-outcome>popup:edit</from-outcome>
>>              <to-view-id>/foo/dialog2.xhtml</to-view-id>
>>          </navigation-case>
>>      </navigation-rule>
>> ...
>>
>> The rendered HTML from dialog.xhtml is included below. I can see that
>> the command link calls submitForm() on click, and tracing through
>> that with Venkman shows that it eventually calls form.submit(). What
>> I'm unclear about is how/where the response gets redirected to a
>> popup window, and how it's getting rendered in the originating window
>> *as well as* in the popup window.
>>
>> I'm using a recent Trinidad build from svn trunk. Any suggestions for
>> how to further diagnose this would be *most* welcome...
>>
>> L.
>>
>>
>> <?xml version='1.0' encoding='UTF-8'?>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
>> TR/html4/loose.dtd">
>> <html dir="ltr" lang="en">
>> <head>
>> <meta name="generator" content="Oracle ADF Faces">
>> <link rel="stylesheet" charset="UTF-8" type="text/css" href="/adf/
>> styles/cache/minimal-desktop-${version}-en-gecko.css">
>> <script>var _AdfWindowOpenError='A popup window blocker has been
>> detected in your browser. Popup blockers interfere with the operation
>> of this application. Please disable your popup blocker or allow
>> popups from this site.';</script>
>> <script src="/adf/jsLibs/Common11-m7.js"></script>
>> <script>_defaultTZ()</script>
>> </head>
>> <body onload="_checkLoad(event)" onunload="_checkUnload(event)">
>> <iframe id="_pprIFrame" name="_pprIFrame" frameborder="0"
>> longdesc="#" title="" src="about:blank"
>> style="position:absolute;top:-100px;visibility:hidden" width="0"
>> height="0"></iframe>
>> <div id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"
>> style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"
>> onkeydown="return false;" onkeyup="return false;" onmousedown="return
>> false;" onmouseup="return false;" onkeypress="return false;"></div>
>> <script>var _cachedLibs;</script>
>> <a name="top"></a>
>> <noscript>This page uses JavaScript and requires a JavaScript enabled
>> browser.Your browser is not JavaScript enabled.</noscript>
>> <form id="_id2" name="_id2" style="margin:0px" method="POST"
>> onkeypress="return _submitOnEnter(event,'_id2');" action="/faces/foo/
>> dialog.xhtml">
>>          <h1>Launch a dialog</h1>
>>          <a onclick="submitForm('_id2',1,{source:'_id4'});return
>> false;" class="xi" href="#">edit</a>
>>          <input type="hidden"
>> name="org.apache.myfaces.trinidad.faces.FORM" value="_id2">
>>          <span id="__id2_Postscript">
>>                  <input type="hidden"
>> name="org.apache.myfaces.trinidad.faces.STATE" value="!-47b9b9a5">
>>                  <input type="hidden" name="source">
>>                  <script>var _reset_id2Names=["source"];</script>
>>                  <script>function __id2Validator(){return true;}var
>> _id2_SF={};</script>
>>          </span>
>>          <script>_submitFormCheck();</script>
>> </form>
>> </body>
>> <!-- Created by Oracle ADF Faces (Version unknown: ADF Faces API  
>> - ??/
>> ADF Faces Implementation - ??), skin:minimal.desktop (minimal) -->
>> </html>
>>
>>
>> --
>> Laurie Harper
>> Open Source advocate, Java geek: http://www.holoweb.net/laurie
>> Founder, Zotech Software: http://www.zotechsoftware.com/
>>
>>
>>
>>
>
>
> -- 
> Matthias Wessendorf
>
> further stuff:
> blog: http://jroller.com/page/mwessendorf
> mail: mwessendorf-at-gmail-dot-com

--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/




Re: Dialogs loading in popup *and* parent window

Posted by Matthias Wessendorf <ma...@apache.org>.
I am using also
Shale, Facelets and Trinidad

no issue here
try to add
partialSubmit="true" immediate="true"


     <tr:commandButton id="button2" text="No Account?"
action="#{dialogBean.createAccount}"
     returnListener="#{dialogBean.returned}" partialSubmit="true"
immediate="true" useWindow="true" windowWidth="400"
windowHeight="400"/>


On 8/23/06, Laurie Harper <la...@holoweb.net> wrote:
> I'm trying to get Trinidad dialogs working in an application and it's
> almost working, with one caveat: when a dialog opens, a new window
> pops up as expected, with the correct page displayed, but the calling
> window *also* refreshes to display the dialog -- in other words, I
> end up with the dialog displayed in both the popup window and the
> originating window.
>
> I have a somewhat involved configuration, using custom ViewHandler
> and NavigationHandler implementations, with Shale, Facelets, Trinidad
> and MyFaces all in the mix, so it's probably some undesired
> interaction between one or more of these components that's causing
> the problem. The trouble is, I'm not quite sure where to start
> looking...
>
> Since the correct dialog *is* opening in a new window, I suspect that
> the undesired refresh of the originating window is due to a mis-step
> somewhere in the dialog handling on the client side. Here's a simple-
> as-possible Facelets view to invoke a dialog:
>
> dialog.xhtml
> ------------
> <tr:document xmlns="http://www.w3.org/1999/xhtml" xmlns:tr="http://
> myfaces.apache.org/trinidad">
>      <tr:form>
>          <h1>Launch a dialog</h1>
>          <tr:commandLink action="popup:edit" useWindow="true">edit</
> tr:commandLink>
>      </tr:form>
> </tr:document>
>
> faces-config.xml
> ----------------
> ...
>      <navigation-rule>
>          <from-view-id>/foo/dialog.xhtml</from-view-id>
>          <navigation-case>
>              <from-outcome>popup:edit</from-outcome>
>              <to-view-id>/foo/dialog2.xhtml</to-view-id>
>          </navigation-case>
>      </navigation-rule>
> ...
>
> The rendered HTML from dialog.xhtml is included below. I can see that
> the command link calls submitForm() on click, and tracing through
> that with Venkman shows that it eventually calls form.submit(). What
> I'm unclear about is how/where the response gets redirected to a
> popup window, and how it's getting rendered in the originating window
> *as well as* in the popup window.
>
> I'm using a recent Trinidad build from svn trunk. Any suggestions for
> how to further diagnose this would be *most* welcome...
>
> L.
>
>
> <?xml version='1.0' encoding='UTF-8'?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/loose.dtd">
> <html dir="ltr" lang="en">
> <head>
> <meta name="generator" content="Oracle ADF Faces">
> <link rel="stylesheet" charset="UTF-8" type="text/css" href="/adf/
> styles/cache/minimal-desktop-${version}-en-gecko.css">
> <script>var _AdfWindowOpenError='A popup window blocker has been
> detected in your browser. Popup blockers interfere with the operation
> of this application. Please disable your popup blocker or allow
> popups from this site.';</script>
> <script src="/adf/jsLibs/Common11-m7.js"></script>
> <script>_defaultTZ()</script>
> </head>
> <body onload="_checkLoad(event)" onunload="_checkUnload(event)">
> <iframe id="_pprIFrame" name="_pprIFrame" frameborder="0"
> longdesc="#" title="" src="about:blank"
> style="position:absolute;top:-100px;visibility:hidden" width="0"
> height="0"></iframe>
> <div id="_pprBlockingDiv" onclick="return _pprConsumeClick(event);"
> style="position:absolute;left:0;top:0;width:0;height:0;cursor:wait;"
> onkeydown="return false;" onkeyup="return false;" onmousedown="return
> false;" onmouseup="return false;" onkeypress="return false;"></div>
> <script>var _cachedLibs;</script>
> <a name="top"></a>
> <noscript>This page uses JavaScript and requires a JavaScript enabled
> browser.Your browser is not JavaScript enabled.</noscript>
> <form id="_id2" name="_id2" style="margin:0px" method="POST"
> onkeypress="return _submitOnEnter(event,'_id2');" action="/faces/foo/
> dialog.xhtml">
>          <h1>Launch a dialog</h1>
>          <a onclick="submitForm('_id2',1,{source:'_id4'});return
> false;" class="xi" href="#">edit</a>
>          <input type="hidden"
> name="org.apache.myfaces.trinidad.faces.FORM" value="_id2">
>          <span id="__id2_Postscript">
>                  <input type="hidden"
> name="org.apache.myfaces.trinidad.faces.STATE" value="!-47b9b9a5">
>                  <input type="hidden" name="source">
>                  <script>var _reset_id2Names=["source"];</script>
>                  <script>function __id2Validator(){return true;}var
> _id2_SF={};</script>
>          </span>
>          <script>_submitFormCheck();</script>
> </form>
> </body>
> <!-- Created by Oracle ADF Faces (Version unknown: ADF Faces API - ??/
> ADF Faces Implementation - ??), skin:minimal.desktop (minimal) -->
> </html>
>
>
> --
> Laurie Harper
> Open Source advocate, Java geek: http://www.holoweb.net/laurie
> Founder, Zotech Software: http://www.zotechsoftware.com/
>
>
>
>


-- 
Matthias Wessendorf

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com