且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

附件的 HTTP 响应标头内容处置

更新时间:2021-09-26 09:05:35

问题

代码存在以下问题:

Problems

The code has the following issues:

  • Ajax 调用 () 不适用于附件.
  • 必须首先创建输出内容.
  • 显示错误消息也不能使用基于 Ajax 的 a4j 标签.
  • An Ajax call (<a4j:commandButton .../>) does not work with attachments.
  • Creating the output content must happen first.
  • Displaying the error messages also cannot use Ajax-based a4j tags.
  1. 更改为 .
  2. 更新源代码:
  1. Change <a4j:commandButton .../> to <h:commandButton .../>.
  2. Update the source code:
  1. bw.write(getDomainDocument());改为bw.write(document);.
  2. try/catch的第一行添加String document = getDomainDocument();.
  1. Change bw.write( getDomainDocument() ); to bw.write( document );.
  2. Add String document = getDomainDocument(); to the first line of the try/catch.

  • (未显示)更改为 .
  • Change the <a4j:outputPanel.../> (not shown) to <h:messages showDetail="false"/>.
  • 本质上,删除所有与 commandButton 相关的 Ajax 工具.仍然可以显示错误消息并利用 RichFaces UI 样式.

    Essentially, remove all the Ajax facilities related to the commandButton. It is still possible to display error messages and leverage the RichFaces UI style.