After a few days of wasting my time with ICEfaces, I switched to RichFaces because at least it tries to integrate with other frameworks without having complete diarrhea for a code base. Seriously, it looks like ICEfaces was written by a bunch of fucking monkeys drunk on gin. Have some pride in your work, assholes. Try formatting your code and not using copy and paste from Spring to make things kind of work… I mean not work at all you fucks. Great look and feel, but total shit on the inside, like an American girl. Nice components, but unusable. You suck. Sun/Oracle is going to have a great time gutting you. Sorry, Ted.

Anyway, RichFaces doesn’t even fucking work, either. They do, however, have a great debugging component called a4j:log, which is really nothing to do with the JBoss infection, or the Exadel infection, but probably someone else in the real world. I don’t know for sure, but it’s probably from a good source. Anyway, this component will spit out your AJAX transaction and save the day. In particular, it will help to solve issues like RICHFACES DOESN’T FUCKING WORK. I don’t give a shit what a certified asshole with the most annoying British stick-up-the-ass name like Gavin says. “Oy, it works with Seam. Guffaw, ol’ chap!” Celebrity developers can suck it. The feel that they generate among other developers is sick. “Oh, so-and-so uses it, so I must waste my time using it in a different, unproven, way that is outside of the Hibernate recipe, ultimately fail, and feel bad about myself.” Not everyone on every project wants to fuck around with these broken frameworks with retarded paradigms and disgusting code that is nearly impossible to debug, unless they really know how to debug and have the time and inclination to do so. I do, so I end up patching a lot of fucked up shit that I shouldn’t have to.

Anyway, the excitement can be found in many places, including here, where Spring announces a brokeass doesn’t fucking work integration with RichFaces. But, I at least found a way to work around it…


So, the a4j:log output, it looks something like this:

debug[18:46:02,025]: Have Event [object Object] with properties: target: http://localhost:8080/xxx/app/admin/sales?execution=e1s1#, srcElement: undefined, type: click
debug[18:46:02,026]: Query preparation for form 'dataTableForm' requested
debug[18:46:02,027]: Append hidden control dataTableForm with value [dataTableForm] and value attribute [dataTableForm]
debug[18:46:02,028]: Append text control dataTableForm:displayRows with value [2] and value attribute [2]
debug[18:46:02,029]: Append hidden control javax.faces.ViewState with value [e1s1] and value attribute [e1s1]
debug[18:46:02,029]: parameter dataTableForm:previousPageLink with value dataTableForm:previousPageLink
debug[18:46:02,029]: Look up queue with default name
debug[18:46:02,030]: NEW AJAX REQUEST !!! with form: dataTableForm
debug[18:46:02,030]: Start XmlHttpRequest
debug[18:46:02,034]: Request state : 1
debug[18:46:02,034]: QueryString: AJAXREQUEST=_viewRoot&dataTableForm=dataTableForm&dataTableForm%3AdisplayRows=2&javax.faces.ViewState=e1s1&dataTableForm%3ApreviousPageLink=dataTableForm%3ApreviousPageLink&
debug[18:46:02,052]: Request state : 1
debug[18:46:03,951]: Request state : 2
debug[18:46:03,954]: Request state : 3
debug[18:46:03,955]: Request state : 3
debug[18:46:03,956]: Request state : 4
debug[18:46:03,957]: Request end with state 4
debug[18:46:03,957]: Response with content-type: text/xml;charset=UTF-8
debug[18:46:03,958]: Full response content: <html xmlns="http://www.w3.org/1999/xhtml"><head></head><body xmlns="http://www.w3.org/1999/xhtml"><dl id="dataTableForm:j_id23" class="rich-messages" style="display: none; "><dt></dt></dl> <center><div class="tableControlPanel"><div class="fLeft"><input id="dataTableForm:displayRows" type="text" name="dataTableForm:displayRows" value="2" maxlength="2" onchange="changeDisplayRows" size="1" /> items per page. 12 found. Showing 2, from 3 to 4. Page 2 / 6.</div><div class="fRight"> <span class="fLeft"><a href="#" id="dataTableForm:previousPageLink" name="dataTableForm:previousPageLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:previousPageLink','parameters':{'dataTableForm:previousPageLink':'dataTableForm:previousPageLink'} } );return false;">« Previous page</a></span><span class="fLeft" style="margin: 0px 5px">2</span><span class="fRight"><a href="#" id="dataTableForm:nextPageLink" name="dataTableForm:nextPageLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:nextPageLink','parameters':{'dataTableForm:nextPageLink':'dataTableForm:nextPageLink'} } );return false;">Next page »</a></span></div><div class="clearer"></div></div></center> <center><table class="rich-table dataTable" id="dataTableForm:dataTable" border="0" cellpadding="0" cellspacing="0"><colgroup span="5"></colgroup><thead class="rich-table-thead"><tr class="rich-table-subheader "><th class="rich-table-subheadercell " scope="col" id="dataTableForm:dataTable:j_id46header"><div id="dataTableForm:dataTable:j_id46header:sortDiv">#</div></th><th class="rich-table-subheadercell " scope="col" id="dataTableForm:dataTable:j_id49header"><div id="dataTableForm:dataTable:j_id49header:sortDiv"><a href="#" id="dataTableForm:dataTable:sortByNameLink" name="dataTableForm:dataTable:sortByNameLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:dataTable:sortByNameLink','parameters':{'sortColumn':'firstName','dataTableForm:dataTable:sortByNameLink':'dataTableForm:dataTable:sortByNameLink'} } );return false;">First Name</a></div></th><th class="rich-table-subheadercell " scope="col" id="dataTableForm:dataTable:j_id52header"><div id="dataTableForm:dataTable:j_id52header:sortDiv"><a href="#" id="dataTableForm:dataTable:sortByNameLink" name="dataTableForm:dataTable:sortByNameLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:dataTable:sortByNameLink','parameters':{'sortColumn':'lastName','dataTableForm:dataTable:sortByNameLink':'dataTableForm:dataTable:sortByNameLink'} } );return false;">Last Name</a></div></th><th class="rich-table-subheadercell " scope="col" id="dataTableForm:dataTable:j_id55header"><div id="dataTableForm:dataTable:j_id55header:sortDiv"><a href="#" id="dataTableForm:dataTable:sortByNameLink" name="dataTableForm:dataTable:sortByNameLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:dataTable:sortByNameLink','parameters':{'sortColumn':'totalSales','dataTableForm:dataTable:sortByNameLink':'dataTableForm:dataTable:sortByNameLink'} } );return false;"># Sales</a></div></th><th class="rich-table-subheadercell " scope="col" id="dataTableForm:dataTable:j_id58header"><div id="dataTableForm:dataTable:j_id58header:sortDiv"><a href="#" id="dataTableForm:dataTable:sortByNameLink" name="dataTableForm:dataTable:sortByNameLink" onclick="A4J.AJAX.Submit('dataTableForm',event,{'similarityGroupingId':'dataTableForm:dataTable:sortByNameLink','parameters':{'sortColumn':'totalCommissions','dataTableForm:dataTable:sortByNameLink':'dataTableForm:dataTable:sortByNameLink'} } );return false;">Total Commissions</a></div></th></tr></thead><tbody id="dataTableForm:dataTable:tb"><tr class="rich-table-row rich-table-firstrow oddRow"><td class="rich-table-cell listNumberColumn" id="dataTableForm:dataTable:0:j_id46">3</td><td class="rich-table-cell listFirstNameColumn" id="dataTableForm:dataTable:0:j_id49">Knwpwibvgiatv</td><td class="rich-table-cell listLastNameColumn" id="dataTableForm:dataTable:0:j_id52">Hplzjtgko</td><td class="rich-table-cell " id="dataTableForm:dataTable:0:j_id55">0</td><td class="rich-table-cell " id="dataTableForm:dataTable:0:j_id58">$0.00</td></tr><tr class="rich-table-row evenRow"><td class="rich-table-cell listNumberColumn" id="dataTableForm:dataTable:1:j_id46">4</td><td class="rich-table-cell listFirstNameColumn" id="dataTableForm:dataTable:1:j_id49">Wttvqqrwsin</td><td class="rich-table-cell listLastNameColumn" id="dataTableForm:dataTable:1:j_id52">Hzyiboe</td><td class="rich-table-cell " id="dataTableForm:dataTable:1:j_id55">0</td><td class="rich-table-cell " id="dataTableForm:dataTable:1:j_id58">$0.00</td></tr></tbody></table></center><meta name="Ajax-Update-Ids" content="dataTableForm:dataTableFragment" xmlns="http://www.w3.org/1999/xhtml" /><span xmlns="http://www.w3.org/1999/xhtml" id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="e1s1" autocomplete="off" /></span><meta xmlns="http://www.w3.org/1999/xhtml" id="Ajax-Response" name="Ajax-Response" content="true" /></body></html>
debug[18:46:03,958]: Header Ajax-Expired not found, search in <meta>
debug[18:46:03,959]: search for elements by name 'meta' in element #document
debug[18:46:03,961]: Find <meta name='Ajax-Update-Ids' content='dataTableForm:dataTableFragment'>
debug[18:46:03,962]: Find <meta name='Ajax-Response' content='true'>
debug[18:46:03,962]: Header Ajax-Update-Ids not found, search in <meta>
debug[18:46:03,963]: search for elements by name 'meta' in element #document
debug[18:46:03,965]: Find <meta name='Ajax-Update-Ids' content='dataTableForm:dataTableFragment'>
debug[18:46:03,965]: Update page by list of rendered areas from response dataTableForm:dataTableFragment
debug[18:46:03,966]: search for elements by name 'script' in element #document
debug[18:46:03,968]: search for elements by name 'link' in element #document
debug[18:46:03,971]: call getElementById for id= org.ajax4jsf.queue_script
debug[18:46:03,971]: Update page part from call parameter for ID dataTableForm:dataTableFragment
debug[18:46:03,972]: call getElementById for id= dataTableForm:dataTableFragment
error[18:46:03,972]: New node for ID dataTableForm:dataTableFragment is not present in response
debug[18:46:03,972]: call getElementById for id= org.ajax4jsf.oncomplete
debug[18:46:03,973]: Processing updates finished, no oncomplete function to call
debug[18:46:03,973]: call getElementById for id= ajax-view-state
debug[18:46:03,974]: Hidden JSF state fields: [object HTMLSpanElement]
debug[18:46:03,974]: Namespace for hidden view-state input fields is undefined
debug[18:46:03,975]: search for elements by name 'input' in element span
debug[18:46:03,978]: Replace value for inputs: 3 by new values: 1
debug[18:46:03,978]: Input in response: javax.faces.ViewState
debug[18:46:03,979]: Found same input on page with type: hidden
debug[18:46:03,980]: search for elements by name 'INPUT' in element span
debug[18:46:03,982]: Replace value for inputs: 3 by new values: 0
debug[18:46:03,983]: call getElementById for id= _A4J.AJAX.focus
debug[18:46:03,984]: No focus information in response

The key line here is this:

error[18:46:03,972]: New node for ID dataTableForm:dataTableFragment is not present in response

That basically means that the client side can’t find an id attribute on the body of the response generated by the server side. It doesn’t know what part of the response it’s supposed to use to replace the renderable section on the client side. After multiple concoctions of ui:fragment and a4j:outputPanel, I just stuck a div tag with this id (dataTableForm:dataTableFragment) inside of the a4j:outputPanel. The server won’t touch it and it will always be there.

After a little mucking around, I found that some things were not submitted correctly in AJAX requests, but using h:panelGroup with the same id as the outputPanel worked. So, my file looks like this:

...
<h:form id="dataTableForm">
<h:panelGroup layout="block" styleClass="section">
<a4j:outputPanel id="dataTableFragment" ajaxRendered="true">
<h:panelGroup id="dataTableFragment" layout="block">
...

Well, now it works. I don’t know who is to blame for this fuckup, but get your act together. At least document it. It’s probably something stupid like the turf battle between Spring and JBoss, but if they don’t integrate flawlessly, they are going down the same nightmare fudge tunnel that software was before open source development took hold. I’m sure all of the usability and workarounds are covered in the documentation and consulting for sale.

  • Digg
  • Delicious
  • StumbleUpon
  • Technorati Favorites
  • Reddit
  • Yahoo Buzz
  • Twitter
  • DZone
  • Google Bookmarks
  • LinkedIn
  • Amazon Wish List
  • Share/Bookmark