我可能错了,但据我所知,在WildFly中必须做到以下几点:
必须能够将链接放到我的JSF视图(即xhtml文件)到已经在WildFly服务器上的资源(pdf、image、其他xhtml文件)。
我可以在php和apache服务器中做同样的事情。
我需要把这些资源放在哪里?我怎样才能从我的观点中获得这些资源?例如,在视图中放置一个链接到一个pdf文件,在一个新的选项卡中打开pdf文件。
非常感谢你的提示和提示!
编辑
standalone.xml
<server name="default-server">
<http-listener name="default" socket-binding="http" max-post-size="974247881"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/content" handler="ContentDir"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
<file name="ContentDir" path="${jboss.home.dir}/standalone/data/unzipped" directory-listing="true"/>
</handlers>JSF视图中的链接
<h:outputLink value="http://localhost:8181/content">KLICK</h:outputLink>当我点击这个目录时,我得到了目录列表,正如您所说的。
但是如何才能使content指向的目录中的content被显示出来呢?这才是我真正想要的。
content指向${jboss.home.dir}/standalone/data/unzipped,在解压缩中有一个index.xhtml以及另一个带有更多.xhtml文件的文件夹。
在index.xhtml中,有指向文件夹中的.xhmtl文件的相对链接:
<ul>
<li><a href="t/rt.html">hg</a></li>
<li><a href="t/tert.html">jghj</a></li>
<li><a href="t/gf.html">jghj</a></li>
<li><a href="t/hg.html">jghj</a></li>
<li><a href="t/hgfh.html">jghj</a></li>
<li><a href="t/hfgh.html">jhgj</a></li>
<li><a href="t/hfgh.html">jhgj</a></li>
<li><a href="t/hg.html">jghj</a></li>
<li><a href="t/hghh.html">jghj</a></li>
</ul>我想要在index.xhtml中显示unzipped文件,然后从那里导航到其他.xhtml文件。
这样的事情一定是可能的,不是吗??
或者,您如何编写一个应用程序,用户可以将html文件上传到Java服务器,然后查看这些文件呢?
发布于 2015-12-23 10:08:24
您可能不希望在应用程序中部署所有静态内容。这些可能是图像、PDF文档或其他类型的文件。为了解决这一问题,您应该配置下面的内容。下面的示例向您展示了如何通过配置subsytem来实现这一点。
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/img" handler="images"/>
</host>
</server>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="false"/>
<file name="images" path="/var/images" directory-listing="true"/>
</handlers>有了这个额外的配置,任何对www.sampledomain.com/contextroot/img的资源请求都将被重定向到硬盘上的文件系统。如果您将“目录-列表”属性标记为false,则请求将被重定向为一个正确显示的文件。
https://stackoverflow.com/questions/34426082
复制相似问题