Question

I started a new java web application project using JSF and Primefaces. I tired to open different web pages in different tabs. For example, lets say i have some pages like a.jsf, b.jsf. If the user clicks the a.jsf page that page should be displayed in a new tab (I'm using p:tabView) and if user clicks then the b.jsf page, then that should be displayed in another new tab like viewing mail in yahoo (old version)

I can generate tab dynamically, but the issue is i can't able to view the page content.

Was it helpful?

Solution

Use an iframe in the tab. You'll soon find that it's difficult to size properly and I found doesn't work in IE (at least versions 8 and below). Best way to do it is to build the code for a.jsf and b.jsf between the <p:tab>....</p:tab> Since they're JSF anyway, it shouldn't be difficult. You can use tabview's dynamic property to help with page load performance.

OTHER TIPS

Here is my code..

<p:layoutUnit position="center" id="layoutCenter">              
    <h:form id="tabViewFormId">
       <p:tabView id="tabViewId" value="#{multiTabBean.tabsList}"
        activeIndex="#{multiTabBean.activeTabIndex}" var="tabView">
        <p:ajax event="tabChange" listener="#{multiTabBean.onTabChange}"/>
        <p:ajax event="tabClose" listener="#{multiTabBean.onTabClose}"/>

        <p:tab title="#{tabView.title}" closable="true">
              <ui:insert name="#{tabView.viewContent}" />
        </p:tab>
    </p:tabView>
    </h:form>
</p:layoutUnit>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top