0

can someone tell me how to override the content of a JSF rich dataTable with another content.. I have a commandLink, which redirects me to another page when clicking on a name. The destinationPage I want to appear instead of the table witch has the commandLink in it.

in list.xhtml(welcome file) I have something like:

<ui:define name="content">
    <h2>Auction List</h2>
<ui:fragment>
    <a:auctionList auctions="#{auctionManager.all}" />
</ui:fragment>
<ui:fragment rendered="#{auctionManager.page eq 'detail'}">
    <ui:include src="detailEnglishType.xhtml" />
</ui:fragment>
</ui:define>

the page is set througt this method:

    public void init()
{
    if(currentAuction==null)
    {
        Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
      String id = params.get("auctionId");

        long longId = Long.parseLong((id));
        this.currentAuction = em.find(Auction.class, longId);

    }
    this.setPage("detail"); //++ getters,setters
}

method "init" is called in a commandLink:

        <rich:column sortBy="#{auct.name}" sortOrder="ascending" >
            <h:commandLink value="#{auct.name}" action="#{auctionManager.init()}">
                <f:param  name="auctionId" value="#{auct.id}"/></h:commandLink>
        </rich:column>

all I want is: <ui:define name="content"> to be replaced by another <ui:define name="content"> defined in destinatin page

Thanks in advance

Nica
  • 55
  • 9
  • By using a `ui:include`??? http://stackoverflow.com/questions/16381447/jsf-2-template-partial-update? – Kukeltje May 11 '17 at 10:52
  • @BalusC: Ahhh you beat me... For one reason or another I always fail to find that page directly... always need two or three google searches.. Now I bookmarked it ;-) – Kukeltje May 11 '17 at 10:55
  • OK. But, i cannot use ui:fragment and ui:include for: because it's not a page set by a Bean.. I want that destinationPage(which is Bean set) to override auctionList(who appears when the user first steps into the web app) – Nica May 11 '17 at 11:58
  • Then **make** it a page set by a bean... Or use 2 `ui:fragment`s that either render either the `a:auctionList` or the `ui:include` – Kukeltje May 11 '17 at 12:05
  • still havent made it(the only displayed page is auctionList).. I edited my question with the modifications made.. have any clue ? – Nica May 11 '17 at 17:02

0 Answers0