简体   繁体   English

GlassFish 4 Alternativedoc不起作用

[英]GlassFish 4 alternatedoc doesn't work

I am trying to reach an external folder using alternatedoc but it doesn't work. 我正在尝试使用alternativedoc访问外部文件夹,但是它不起作用。 I put images in C:/users/salih/downloads and mapped images folder to this folder, but i couldn't make it work. 我将图像放在C:/users/salih/downloads并将images文件夹映射到此文件夹,但是我无法使其工作。

Here is glassfish-web.xml 这是glassfish-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
  <resource-ref>
    <res-ref-name>jdbc/mysql</res-ref-name>
    <jndi-name>jdbc/mysql</jndi-name>
  </resource-ref> 
   <context-root>/Shiro</context-root>
      <property name="alternatedocroot_1" value="from=/images/* dir=c:/users/salih/downloads" description="Uploaded Images"/>
</glassfish-web-app>

Here is the page where i try to access an image under c:/users/salih/downloads 这是我尝试在c:/users/salih/downloads下访问图像的页面

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        Photo Detail
        <img src="images/adevices8.png" width="34" height="34"/>
    </h:body>
</html>

The mapping is maybe a bit unintuitive. 映射可能有点不直观。 You need to put the images in 您需要将图像放入

c:/users/salih/downloads/images/

If u define your docroot like that 如果你这样定义你的docroot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM