我正在使用: -primefaces的扩展\ 3.1.0 \ primefaces的扩展-3.1.0.jar -Java 7 -tomcat 7
在我的xhtml文件中,我声明了这段代码:
<p:commandLink id="downloadLink" ajax="true" title="#{document.name}" action="#{documentSearchController.createDocumentViewer()}" style="color: black !important; text-decoration: none;"
oncomplete="PF('dlg01').show(); return false;" update="documentViewerDialog pdfvisualizer">
<h:outputText value="#{document.name}" style="font-weight: bold;"></h:outputText>
<f:setPropertyActionListener value="#{document}" target="#{documentSearchController.view.selectedDocument}" />
<p:dialog showEffect="fold" hideEffect="fold" header="#{document.name}" id="documentViewerDialog" widgetVar="dlg01" modal="true" dynamic="true" >
<pe:documentViewer height="400" width="800" id="pdfvisualizer" value="#{documentSearchController.view.contentViewer}" download="#{document.name}"/>
</p:dialog>
</p:commandLink>
contentViewer是一个StreamedContent。这是我的Java代码:
DocumentSearchController.java
public void createDocumentViewer() {
LOGGER.debug("Downloading document...");
DocumentVo selectedDoc = getView().getSelectedDocument();
if (selectedDoc != null && selectedDoc.getOriginal() != null) {
InputStream is = rechercheFacade.findById(selectedDoc.getOriginal().getId());
getView().setContentViewer(new DefaultStreamedContent(is, selectedDoc.getOriginal().getMimeType(),
selectedDoc.getName()));
}
}
调用documentViewer时,我有这个例外:
JSF1064 : Impossible de localiser ou de servir une ressource, documentviewer/viewer.html, depuis la bibliothèque primefaces-extensions.
janv. 26, 2018 4:28:46 PM com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource
AVERTISSEMENT:
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Une connexion existante a dû être fermée par l’hôte distant
at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:396)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426)
at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:339)
at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:421)
在org.primefaces.extensions.component.documentviewer.DocumentViewerRenderer(第42行)中,在评估值时:
writer.writeAttribute("src", generateSrc(context, documentViewer), null);
我有这个:
javax.faces.resource /的DocumentViewer / viewer.html.xhtml LN = primefaces的扩展&安培; V =&3.1.0放大器; FILE =%2FmyProject幅%2Fjavax.faces.resource%2Fdynamiccontent.properties.xhtml%3Fln% 3Dprimefaces%26pfdrid%3Dsh1wqWH16DaeFl8tcXfihvHXqz3pBhmdR6eEyycy7B7SwznPx8mFNkrUrcHPPCkZ%26pfdrt%3Dsc%26pfdrid_c%3Dfalse%26uid%3D46a67391-d1c0-486c-8069-17f91c31272d#语言环境= FR
我发现很多帖子都有相同的问题,但没有人给出答案