I have two xhtml pages and two managed beans.
On first page I have a list of topics (records from database table - second column contains <h:commandLink>
tags):
Part of reduced code:
<rich:column><h:outputText value="#{item.id}"/></rich:column>
<rich:column><h:outputText value="#{item.createdBy}"/></rich:column>
<rich:column>
<h:commandLink value="#{item.topic}" action="#{myTools.setMenuItem('posts')}"/>
</rich:column>
I'm using action="#{myTools.setMenuItem('posts')}"
to redirect to page posts.xhtml.
How can I pass the parameter "#{item.id}"
to be able to find all posts to topic with given ID?
UPDATE (using DataModel): This could be the way:
<h:commandLink value="#{item.topic}" action="#{myTopic.submit}">
public String submit()
{
topic = model.getRowData();
return "/posts.xhtml?faces-redirect=true&id=" + topic.getId();
}
But I still don´t know how to pass the topic.getId()
parameter to another bean (MyPosts)..?