Reputation: 1588
I have a h:outputLink
which opens new JSF page and sends h:param
.
<h:outputLink id="lnkHidden" action="#{HistoryLinkController.linkValue("test")}" value="HistoryLink.xhtml" style="display:none">
<f:param name="id" value="#{item.aSessionID}" />
</h:outputLink>
I want when I click it to send a value to a second managed bean. I tried to implement it with action="#{HistoryLinkController.linkValue("test")}"
but I get error. Is there any attribute that I can use for this purpose?
Upvotes: 0
Views: 5493
Reputation: 660
Try using a <h:commandLink>
in the following way and it should work fine
<h:commandLink id="hLink" value="History" action="#{HistoryLinkController.linkValue}" >
<f:param name="sessID" value="#{item.aSessionID}" />
</h:commandLink>
and the bean "HistoryLinkController" should have a method like
public String linkValue(){
// get "sessID" from FacesContext
...
return "/HistoryLink.xhtml";
}
Upvotes: 5
Reputation: 1704
I have also tried to navigate to some view along with passing a value to another bean already but I didn't get it. But what I got is---
U can remain in the same bean class if possible, and use navigation rules
in faces-config.xml
for navigating to another page.
And In ajax, action
will be called earlier than its actionListener
.
Hope it helps you finding a way...
Upvotes: 1