Parent is not of type ActionSource

问题描述 投票:4回答:3

我想点击表格行时传递值:

<h:outputLink id="lnkHidden" value="DatacenterProfile.html" style="text-decoration:none; color:white;">
    <f:setPropertyActionListener target="#{DatacentersController.selectedId}" value="#{item.componentStatsId}" />
</h:outputLink>

我收到此错误:

<f:setPropertyActionListener> Parent不是ActionSource类型,类型为:javax.faces.component.html.HtmlOutputLink@aa25b91

有没有适当的JSF标签可以用来取代<h:outputLink>

jsf parent setpropertyactionlistener
3个回答
5
投票

f:setPropertyActionLister仅适用于ActionSourceh:commandLinkh:commandButton组件。如果你想这样做,你应该使用其中之一。也可以看看


1
投票

您是否希望保留您的URL(href),或者您只是希望它像按钮一样?

  1. 如果你想保留URL(显然是它的params,所以你可以在其他标签中打开它等等),只需使用f:param而不是f:setPropertyActionLister
  2. 如果丢失URL显示(没有显示有意义的URL),你可以使用Chkal说,commandButtoncommndLink

0
投票

除了@BalusC的答案。我在我的项目中使用了类似的东西。

<h:commandButton 
       id="" 
       styleClass="" 
       type="submit" 
       rendered="#{}" 
       value="#{}" 
       action="#{}"> 
       <f:setPropertyActionListener target="#{}" value="#{}" /> 
</h:commandButton>

您可以根据您的方案传递/使用属性。

© www.soinside.com 2019 - 2024. All rights reserved.