i'm having a column with auctions' name like this:
<rich:column sortBy="#{auct.name}" sortOrder="ascending" >
<h:outputLink value="detailEnglishType.xhtml?auctionId=#{auct.id}" rendered="#{auct.auctionTypes eq 'ENGLISH'}">#{auct.name}</h:outputLink>
<h:outputLink value="detailDutchType.xhtml?auctionId=#{auct.id}" rendered="#{auct.auctionTypes eq 'DUTCH'}">#{auct.name}</h:outputLink>
</rich:column>
and after the GET request happens, in destination page:
<ui:define name="view">
<f:metadata>
<f:viewParam name="auctionId" rendered="#{auctionManager.currentAuction != null}"
value="#{currentAuction.init(auctionId)}" />
</f:metadata>
</ui:define>
and the init method from the AuctionBean(it's ViewScoped, Stateful):
public void init(long auctionId) {
if (auctionId == 0) {
String message = "Bad request.";
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, message, null));
return;
}
this.currentAuction = em.find(Auction.class, auctionId);
}
and the get method:
@Produces
@Named
@CurrentAuction
@Dependent
@PermitAll
public Auction getCurrentAuction() {
if (currentAuction != null && em.contains(currentAuction)) {
currentAuction = em.merge(currentAuction);
}
return currentAuction;
}
what happens is that the currentAuction is NULL after the GET request, not being set at all. I can t use @PostConstruct because i'm using CDI Beans.
Anyone any idea, please ? I'm really struggling with this issue...
Thanks