- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 primefaces dataExporter 导出一些数据,并且我有一个包含人名的列,该名称是指向外部网站的链接。
最初我有以下代码,然后我发现 this线程说 dataExporter 现在支持 h:commandLink
<p:dataTable var="inv" value="#{personBacker.investigators}" id="tbl" rows="50" effect="true">
<p:column filterBy="#{inv.name}" headerText="Investigator" filterMatchMode="contains">
<h:outputLink value="http://example.com/">
<h:outputText value="#{inv.name}" />
</h:outputLink>
</p:column>
</p:dataTable>
然后我将代码更改为此,但现在该链接无法将我带到 example.com。根据我在互联网上发现的内容,我认为 commandLink 只能使用 EL 表达式。
<p:dataTable var="inv" value="#{personBacker.investigators}" id="tbl" rows="50" effect="true">
<p:column filterBy="#{inv.name}" headerText="Investigator" filterMatchMode="contains">
<p:commandLink action="http://example.com" value="#{inv.name}" />
</p:column>
</p:dataTable>
如何使用 h:commandLink 或 p:commandLink 标记链接到外部网站?
最佳答案
我不知道我的建议是否适用于您使用 DataExporter 的设置,但要从 commandLink/commandButton 调用外部链接,我使用以下命令在我的设置中:
<p:commandLink value="external link" ajax="false" action="#{bean.externalLink()}" />
bean :
public void externalLink() throws IOException {
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
// call external link
String link = "http://www.google.com";
ec.redirect(link);
}
另一种方法是尝试直接将链接设置为 html 标签。这应该不会太难,因为您在代码中表明 URL 已经已知:
<a href="http://www.example.com">#{inv.name}</a>
希望这对您有所帮助,祝您玩得开心!
关于java - 尝试让 primefaces dataExporter 显示链接值而不是 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9807836/
我有一个 Primefaces DataGrid,我用 Primefaces DataExporter 导出它,但我不知道如何调整列的大小。 我添加了一个预处理器 这是我的 bean 中的代码 pu
我有 65000 个数据用于从 DB 获取到 excel。但是 PF DataExporter 组件没有将大数据写入 excel。我可以在这个过程中使用什么?这个过程有库吗? 最佳答案 您可以使用:
我正在将数据从 p:dataTable 导出到 excel 文件中,并且我使用 标签以特殊方式格式化其中一列中的数据。 这是布局: 问题是当我导出表格时, 标签会像这样打印到 excel 文档中: 我
我有一个可编辑的 与 我想使用 将该表格的内容导出为 PDF 格式. 我已经包括了 itext 2.1.7 jar .我得到了 PDF 格式的输出,但它显示了 Object#toString()所有
我正在尝试使用 primefaces dataExporter 导出一些数据,并且我有一个包含人名的列,该名称是指向外部网站的链接。 最初我有以下代码,然后我发现 this线程说 dataExport
似乎在最新版本的 PrimeFaces 中,为 DataExporter 添加了新类型(请参阅当前 primefaces 6.2 文档中的 ExporterType) 我似乎在网络上找不到有关新 Ap
环境: jsf 2.2 primefaces 6.1 飞翔10 我正在尝试使用 primefaces 的 dataExporter 将数据表导出到 Excel,但我首先得到
public void preProcessPDF(Object document) throws IOException, BadElementException, DocumentExcepti
我有一个 :
我想将 PDF 页面大小更改为 A4 风景导出表时。但无论我做什么,我都无法完成它.. 这是我的代码: 其中托管 bean 的方法非常简单: public voi
我正在使用 Primefaces 3.4 并尝试使用单元内编辑导出数据表。它似乎不起作用。 我做了以下事情: 修改 org.primefaces.component.export.Exporter 第
我使用的是 primefaces 3.5,我有一个包含一些行和数据的 p:dataTable,我想将这些数据导出到 xls 文件或其他文件中。 我使用了代码: 这很好用! 我的问题是,我
PrimeFace p:dataExporter默认情况下,标记将数字数据导出为文本,这会导致单元格的左上角带有绿色三角形。这可以在 PrimeFaces showcase example 中看到同样
我在尝试导出包含某些列的 DataTable 时遇到问题,DataTable 和 Column 组件都是复合元素,如下所示: 自定义数据表 XHTML (v:dataTable):
我尝试使用PrimeFaces 3.2的数据导出器控件。代码如下: 当我单击导出链接时,出现以下错误: java.lang.NoClassDefFoundError: com/low
我是一名优秀的程序员,十分优秀!