The code has the following issues:
<a4j:commandButton .../>
) does not work with attachments.a4j
tags.<a4j:commandButton .../>
to <h:commandButton .../>
.bw.write( getDomainDocument() );
to bw.write( document );
.String document = getDomainDocument();
to the first line of the try/catch
.<a4j:outputPanel.../>
(not shown) to <h:messages showDetail="false"/>
.Essentially, remove all the Ajax facilities related to the commandButton
. It is still possible to display error messages and leverage the RichFaces UI style.