image - 使用 tomcat7 和 primefaces 显示来自绝对目录的图像

标签 image tomcat primefaces directory

我想从 p:graphicImage 获取我保存到绝对目录中的图像

我测试了this solution (BalusC) :

但是图片没有出现:

这是我的 xhtml 代码:

<h:form prependId="false" enctype="multipart/form-data">
    <p:fileUpload binding="#{upload}" mode="simple" id="monfileupload" 
                  value="#{articleMB.uploadedPicture}"/>
    <p:commandLink id="mylink" onclick="uploader();">
        <h:graphicImage id="monimage" value="/images/Chrysanthemum.jpg" 
                        height="64"  width="64" binding="#{image}" />
    </p:commandLink>
    <p:commandButton actionListener="#{articleMB.ajouter}" value="submit"
                     ajax="false" />
</h:form>

这是 tomcat 的配置(在 server.xml 中):

<Context docBase="C:/images_test" path="/images" />

这是目录: enter image description here

不知道怎么回事

最佳答案

由于您使用的是 tomcat 7,所以别名属性的使用会对您有所帮助。

<Context ... aliases="/images=c:\images_test\">

您可能会在 http://tomcat.apache.org/tomcat-7.0-doc/config/context.html 上更多地了解属性的上下文参数

关于image - 使用 tomcat7 和 primefaces 显示来自绝对目录的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15658964/

相关文章:

image - 计算像素的积分图像(求和面积表)

html - CSS 使图像适合 100% 宽的 div

tomcat - 如何以管理员身份启动tomcat服务

performance - Grails 性能 : XML processing 4x slower in tomcat than run-app?

css - Wordpress 页脚有正文背景图像重叠

python - 从原始 RGB 深度图像到灰色的错误转换

tomcat - 如何在tomcat服务器上升级birtviewer 3.7.2到4.3.1

css - 基于内容长度的动态数据表列宽

html - 无法更改 Primefaces p :commandButton font properties

jsf - 如何调用 p :commandButton in the error page shown by FullAjaxExceptionHandler?