Ok... please bare with me as this is the first time I have really dug
into the internals of trinidad and myfaces.  The problem seems to be
coming from the JspViewHandlerImpl class inside the renderView method.
I'm not really sure what is trying to be accomplished, but the response
writer is getting replaced with an instance of StateAwareResponseWriter
which wraps a StringBuffer.  The StateAwareResponseWriter is then
wrapped by an XhtmlResponseWriter and an instance of PPRResponseWriter.
Once this is done, the partial view is rendered to the writer.  The
state aware writer then gets flushed to the real response writer and
then the ppr writer's endDocument method is called.  Inside the
endDocument method of the ppr writer, the buffered script tags and
</content> element are sent to the ppr's writer.  The problem is, this
writer never get's flushed to the real writer.  Since the state aware
writer wraps a string buffer, this information get lost forever. 

The whole thing starts on line 297 of
org.apache.myfaces.application.jsp.JspViewHandlerImpl

Don't know if this helps...

Tim

-----Original Message-----
From: Timothy M. Braun [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 14, 2007 9:56 AM
To: MyFaces Discussion
Subject: RE: [Trinidad] tr:table PPR failing

So I did a little more investigating and something really interesting is
going on.  I set a breakpoint in PPRResponseWriter.endDocument().  This
is where the </content> element get appended to the response.  If I look
at the output buffer at this stage, I can see there is a lot of
information with seems to be missing from the response the browser
receives.  I have included the buffer contents below.  As you can see,
the browser doesn't see anything past the last </fragment> element so
it's not receiving the script elements either.

Any Ideas?
Tim

<?xml version="1.0" ?>
<?Tr-XHR-Response-Type ?>
        <content
        
action="/vbm/faces/pages/secure/telephony/accountSearch.jspx">
                <fragment><![CDATA[<div
id="j_id_jsp_1566647018_3:acctTable"><table cellpadding="0"
cellspacing="0" border="0" width="90%" summary=""><tr><td><table
cellpadding="0" cellspacing="0" border="0" width="100%" summary=""
class="x6m"><tr><td><button type="button"
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:j_id_jsp_1566647018_15'});return false;" class="x6s">Clear
Results</button></td><td
width="100%"></td></tr></table></td></tr><tr><td><table cellpadding="0"
cellspacing="0" border="0" width="100%" summary="" class="x6q"><tr><td
nowrap="nowrap" valign="middle"><a onclick="return
_submitHideShow('acctForm',1,'show','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTable__xc_sa','all')" href="#"
id="j_id_jsp_1566647018_3:acctTable__xc_sa" class="xi">Show All
Details</a>&#xa0;|&#xa0;<a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTable__xc_ha','all')" href="#"
id="j_id_jsp_1566647018_3:acctTable__xc_ha" class="xi">Hide All
Details</a></td></tr></table></td></tr><tr><td><table class="x6k"
cellpadding="1" cellspacing="0" border="0" width="100%"><tr><th
id="j_id0" width="1%" nowrap="nowrap" class="x75">Details</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_16" class="x75
xaf">Name</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_18" class="x75
xaf">Active</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_20" class="x75
xaf">Actions</th></tr><tr><td headers="j_id0" class="x6v xat"
nowrap="nowrap"><div><a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTabledd0','0')" href="#"
id="j_id_jsp_1566647018_3:acctTabledd0"><span title="Select to hide
information" class="x9q">&#x25bc;</span></a><a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTabledd0','0')" href="#"
class="xi">Hide</a></div></td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_16"
class="x6v xat">Name Removed</td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_18"
class="x6v xat">true</td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_20"
class="x6v xat"><a
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:0:j_id_jsp_1566647018_21'});return false;" class="xi"
href="#">Close</a></td></tr><tr><td headers="j_id0" colspan="4"
class="x79 xat"><div class="x9m"><h3 class="x65">Account
Details</h3><div>Bill Cycle: Independant<div></div>Created:
12/15/2006<div></div>Last Modified: 12/15/2006</div><div class="x9m"><h4
class="x65">Plans</h4><div
id="j_id_jsp_1566647018_3:acctTable:0:j_id_jsp_1566647018_32"><table
cellpadding="0" cellspacing="0" border="0" width="50%"
summary=""><tr><td><table class="x6k" cellpadding="1" cellspacing="0"
border="0" width="100%"><tr><th scope="col" class="x75">Type</th><th
scope="col" class="x75 xaf">Extension</th><th scope="col" class="x75
xaf">DID Number</th><th scope="col" class="x75 xaf">Active</th><th
scope="col" class="x75 xaf">Actions</th></tr><tr><td class="x6v
xat">Basic 250</td><td class="x6v xat">5112</td><td class="x6v
xat">(908) 604-0215</td><td class="x6v xat">true</td><td class="x6v
xat"><a
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:0:j_id_jsp_1566647018_32:0:j_id_jsp_1566647018_43'});return false;"
class="xi" href="#">View</a></td></tr></table></td></tr></table><input
type="hidden"
name="j_id_jsp_1566647018_3:acctTable:0:j_id_jsp_1566647018_32:rangeStar
t"
value="0"></input></div></div></div></td></tr></table></td></tr></table>
<input type="hidden" name="j_id_jsp_1566647018_3:acctTable:rangeStart"
value="0"></input></div>]]></fragment>
                <fragment><![CDATA[<span
id="_acctForm_Postscript"><input type="hidden"
name="javax.faces.ViewState" value="!3ca5b351"></input><input
type="hidden" name="event"></input><input type="hidden"
name="source"></input><input type="hidden" name="partial"></input><input
type="hidden" name="value"></input><input type="hidden"
name="state"></input></span>]]></fragment>
                <script><![CDATA[function _submitHideShow(a,v,b,c,l,d)
{var o = {event:b,source:c};if (d!=(void 0))
o.value=d;_setRequestedFocusNode(document,l,false,window);_submitPartial
Change(a,v,o);return false;}]]></script>
        
<script><![CDATA[_uixt_j_id_jsp_1566647018_3_acctTable_0_j_id_jsp_156664
7018_32=new
CollectionComponent('acctForm','j_id_jsp_1566647018_3:acctTable:0:j_id_j
sp_1566647018_32');]]></script>
        
<script><![CDATA[_uixt_j_id_jsp_1566647018_3_acctTable=new
CollectionComponent('acctForm','j_id_jsp_1566647018_3:acctTable');]]></s
cript>
                <script><![CDATA[var
_resetacctFormNames=["event","source","partial","value","state"];]]></sc
ript>
                <script><![CDATA[function _acctFormValidator(){return
true;}var acctForm_SF={};]]></script>
        </content>


-----Original Message-----
From: Timothy M. Braun [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 14, 2007 12:26 AM
To: MyFaces Discussion
Subject: RE: [Trinidad] tr:table PPR failing

Adam--
        I used firebug and the problem arises from a parse error of the
xml response.  It seems as though the </content> closing element is
missing from the response.  I have included the text from the response
below.

<content
        action="/vbm/faces/pages/secure/telephony/accountSearch.jspx">
        <fragment><![CDATA[<div
id="j_id_jsp_1566647018_3:acctTable"><table cellpadding="0"
cellspacing="0" border="0" width="90%" summary=""><tr><td><table
cellpadding="0" cellspacing="0" border="0" width="100%" summary=""
class="x6m"><tr><td><button type="button"
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:j_id_jsp_1566647018_15'});return false;" class="x6s">Clear
Results</button></td><td
width="100%"></td></tr></table></td></tr><tr><td><table cellpadding="0"
cellspacing="0" border="0" width="100%" summary="" class="x6q"><tr><td
nowrap="nowrap" valign="middle"><a onclick="return
_submitHideShow('acctForm',1,'show','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTable__xc_sa','all')" href="#"
id="j_id_jsp_1566647018_3:acctTable__xc_sa" class="xi">Show All
Details</a>&#xa0;|&#xa0;<a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTable__xc_ha','all')" href="#"
id="j_id_jsp_1566647018_3:acctTable__xc_ha" class="xi">Hide All
Details</a></td></tr></table></td></tr><tr><td><table class="x6k"
cellpadding="1" cellspacing="0" border="0" width="100%"><tr><th
id="j_id0" width="1%" nowrap="nowrap" class="x75">Details</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_16" class="x75
xaf">Name</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_18" class="x75
xaf">Active</th><th
id="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_20" class="x75
xaf">Actions</th></tr><tr><td headers="j_id0" class="x6v xat"
nowrap="nowrap"><div><a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTabledd0','0')" href="#"
id="j_id_jsp_1566647018_3:acctTabledd0"><span title="Select to hide
information" class="x9q">&#x25bc;</span></a><a onclick="return
_submitHideShow('acctForm',1,'hide','j_id_jsp_1566647018_3:acctTable','j
_id_jsp_1566647018_3:acctTabledd0','0')" href="#"
class="xi">Hide</a></div></td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_16"
class="x6v xat">Name removed for privacy</td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_18"
class="x6v xat">true</td><td
headers="j_id_jsp_1566647018_3:acctTable:j_id_jsp_1566647018_20"
class="x6v xat"><a
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:0:j_id_jsp_1566647018_21'});return false;" class="xi"
href="#">Close</a></td></tr><tr><td headers="j_id0" colspan="4"
class="x79 xat"><div class="x9m"><h3 class="x65">Account
Details</h3><div>Bill Cycle: Independant<div></div>Created:
12/15/2006<div></div>Last Modified: 12/15/2006</div><div class="x9m"><h4
class="x65">Plans</h4><div
id="j_id_jsp_1566647018_3:acctTable:0:j_id_jsp_1566647018_32"><table
cellpadding="0" cellspacing="0" border="0" width="50%"
summary=""><tr><td><table class="x6k" cellpadding="1" cellspacing="0"
border="0" width="100%"><tr><th scope="col" class="x75">Type</th><th
scope="col" class="x75 xaf">Extension</th><th scope="col" class="x75
xaf">DID Number</th><th scope="col" class="x75 xaf">Active</th><th
scope="col" class="x75 xaf">Actions</th></tr><tr><td class="x6v
xat">Basic 250</td><td class="x6v xat">5112</td><td class="x6v
xat">(908) 604-0215</td><td class="x6v xat">true</td><td class="x6v
xat"><a
onclick="submitForm('acctForm',1,{source:'j_id_jsp_1566647018_3:acctTabl
e:0:j_id_jsp_1566647018_32:0:j_id_jsp_1566647018_43'});return false;"
class="xi" href="#">View</a></td></tr></table></td></tr></table><input
type="hidden"
name="j_id_jsp_1566647018_3:acctTable:0:j_id_jsp_1566647018_32:rangeStar
t"
value="0"></input></div></div></div></td></tr></table></td></tr></table>
<input type="hidden" name="j_id_jsp_1566647018_3:acctTable:rangeStart"
value="0"></input></div>]]></fragment>
        <fragment><![CDATA[<span id="_acctForm_Postscript"><input
type="hidden" name="javax.faces.ViewState"
value="!-4bdfb93a"></input><input type="hidden"
name="event"></input><input type="hidden" name="source"></input><input
type="hidden" name="partial"></input><input type="hidden"
name="value"></input><input type="hidden"
name="state"></input></span>]]></fragment>

Thanks,
Tim

-----Original Message-----
From: Adam Winer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 13, 2007 12:46 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] tr:table PPR failing

On 9/13/07, Adam Winer <[EMAIL PROTECTED]> wrote:
> On 9/13/07, Andrew Robinson <[EMAIL PROTECTED]> wrote:
> > Timothy,
> >
> > I stripped the page and the AJAX down to the ID attributes only
> > (FYI I used this set of commands with VIM to do this:
> > %s/></>\r</g | %s/^.\+\(id="[^"]\+"\).*/\1/ | %s/^[^i].\+\n// | sort
> > )
>
> Can I get you on permanent retainer for VIM-editing? :)
>
> > Here are the results:
> >
> > Page:
> > id="acctPage:acctTable"
> > id="acctPage:acctTable:j_id_jsp_1566647018_17"
> > id="acctPage:acctTable:j_id_jsp_1566647018_19"
> > id="acctPage:acctTable:j_id_jsp_1566647018_21"
> > id="acctPage:acctTable__xc_ha"
> > id="acctPage:acctTable__xc_sa"
> > id="acctPage:acctTabledd0"
> > id="j_id0"
> >
> > AJAX response:
> > id="_acctForm_Postscript"
> > id="acctPage:acctTable"
> > id="acctPage:acctTable:0:j_id_jsp_1566647018_33"
> > id="acctPage:acctTable:j_id_jsp_1566647018_17"
> > id="acctPage:acctTable:j_id_jsp_1566647018_19"
> > id="acctPage:acctTable:j_id_jsp_1566647018_21"
> > id="acctPage:acctTable__xc_ha"
> > id="acctPage:acctTabledd0"
> > id="j_id0"
> >
> > As you can see, the following items in the AJAX were not in the
page:
> > id="_acctForm_Postscript"
> > id="acctPage:acctTable:0:j_id_jsp_1566647018_33"
> >
> > Looking at your page source, there is no form element. The form is
> > required AFAIK. This may be just because you didn't provide the full
> > source though.
>
> I suspect so... the submission wouldn't have gotten far at all
> without a form element.  The "postscript" in the PPR reply
> is in fact part of the form.
>
> It looks as though the issue is exactly related to trying to get that
> expanded row to show up, since the one missing ID is ":0:"
> (that is, the first row of the table).  Lemme try this locally.

Ech, ignore that commentary.  Diffing the full set of IDs isn't
really relevant here:  PPR can, of course, introduce new IDs.
It just can't introduce new *top* IDs - each fragment has to
point to an existing ID.  We've got two fragments in here:

<div id="acctPage:acctTable">
<span id="_acctForm_Postscript">

And these do seem to be in the page already.  But even
if they weren't, it seems that the current JS code would simply
drop them and move on.

Tim, could you by any chance use FireBug's JS debugger to
step through TrPage.prototype._handlePprResponse()?  It's
not clear where this JS error is coming from.

(FWIW, the basic table row-disclosure demo seems to be working
fine for me, at least on FF (haven't tested IE)).

-- Adam



Reply via email to