如果我改变
image="#{pageContext.servletContext.contextPath}/upload
/#{fileUploadController.imagemTemporaria}"
并放
image="/imagens/#{fileUploadController.imagemTemporaria}"
图像已加载。另一方面,crop 方法停止工作。
我的图片在F:\imagens-retaguarda\imagens
我的描述符包含以下内容
<property name="alternatedocroot_1" value="from=/imagens/*
dir=F:\imagens-retaguarda\" />
你知道为什么会这样吗?
下面是我的代码。
<h:form>
<p:outputPanel id="outputPanelUpload">
<h:panelGrid columns="2">
<h:outputText value="Imagem" rendered="#{fileUploadController.exibeBotao}"/>
<h:outputText value="Pré-visualização" rendered="#{fileUploadController.exibeBotao}"/>
<p:imageCropper id="imageCropperImagemTemporaria"
value="#{fileUploadController.croppedImage}"
image="#{pageContext.servletContext.contextPath}/upload/#{fileUploadController.imagemTemporaria}"
initialCoords="0,0,50,50"
maxSize="250,163"
minSize="30,30" />
<h:panelGroup rendered="#{fileUploadController.exibirPreVisualizacao}">
<p:graphicImage value="#{fileUploadController.imagemEnviada}" cache="false"/>
</h:panelGroup>
</h:panelGrid>
<br/>
<p:commandLink action="#{fileUploadController.crop}" update="outputPanelUpload" rendered="#{fileUploadController.exibeBotao}" value="Pré-visualizar" id="preVisualizar"/>
</p:outputPanel>
<br/>
<br/>
<p:fileUpload fileUploadListener="#{fileUploadController.enviarImagem}" sizeLimit="1000000" auto="true" update="outputPanelUpload" label="Escolher"/>
</h:form>