I am trying to pass some parameters from one managed bean to another. I saw similar question and applied their solutions but does not work. Here is the code:
In my moneytransfer.xhtml file:
<h:commandButton action="#{moneyTransferBean.transferAccounts()}" value="Continue">
<f:param name="sender" value="#{extTableSelectionBean.sender}" />
</h:commandButton>
My extTableSelectionBean:
@ManagedBean
@ViewScoped
public class ExtTableSelectionBean implements Serializable {
private Account sender;
public void setSender(Account sender){
this.sender=sender;
}
public Account getSender(){
return sender;
}
and the moneyTransferBean:
@ManagedBean
@ViewScoped
public class MoneyTransferBean {
@ManagedProperty("#{extTableSelectionBean .sender}")
private Account sender;
//NO SETTER-GETTER FOR sender here
public void transferAccounts() throws IOException {
if (sender != null)
{
FacesContext.getCurrentInstance().getExternalContext().redirect("transferaccount.xhtml");
}
}
}
I see that in extTableSelectionBean, the "sender" is succesfully set. The problem is, when i get to the moneyTransferBean, sender becomes null. What should i do about it, what am i doing wrong?
Thanks