如何在JSF页面中下载文件 [英] How to download file in JSF page
问题描述
我想创建一个JSF页面,该页面从目录/opt/glassfish3/glassfish/domains/domain1/logs/
I want to create JSF page which downloads Glassfish log files from the directory /opt/glassfish3/glassfish/domains/domain1/logs/
我发现了此 Primefaces教程.我感兴趣的是,有没有办法用纯JSF达到相同的结果?
I found this Primefaces tutorial. I'm interested is there any possible way to make the same result with pure JSF?
推荐答案
看看JCA,并四处寻找提供文件I/O的优质JCA适配器.如果您使用的是Java EE应用程序,则可能希望使用容器公开的资源(而不是原生")正确实现的JCA适配器也可以/应该提供的事务优势(ACID,回滚等).通过接触容器外部的资源(文件,套接字等),可以使部署安全性正常运行.
Take a look at JCA, and look around for a good JCA adapter that provides file i/o. if you're working in a Java EE app, you probably want the transactional advantages that a properly implemented JCA adapter can/should provide (ACID, rollback, etc.) also, using a resource exposed by the container rather than "going native" will allow deployment security to operate properly wrt touching resources outside the container (files, sockets, etc.).
这篇关于如何在JSF页面中下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!