Board index JavaServer Faces General Bug? tabView error - tab content not loading

Bug? tabView error - tab content not loading

Components, Ajax Framework, Utilities and More.


Posts: 36
I cannot seem to make the dynamic tabView work. I even tried copying and pasting the code straight from the web site. The first tab content loads without a problem. The other tabs do not have any content.

This code works just fine:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <p:tabView>

                <p:tab title="Godfather Part I">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather1.jpg" />
                        <h:outputText
                            value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
                            His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. T
                            hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect,
                            but given to ruthless violence whenever anything stands against the good of the family." />
                    </h:panelGrid>
                </p:tab>

                <p:tab title="Godfather Part II">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather2.jpg" />
                        <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream.
                        In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy,
                        killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows."/>
                    </h:panelGrid>
                </p:tab>

                <p:tab title="Godfather Part III">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather3.jpg" />
                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.
                            Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate."/>
                    </h:panelGrid>
                </p:tab>

            </p:tabView>
        </h:form>
    </h:body>
</html>



The same code, with the exception of the dynamic attribute, doesn't work:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <p:tabView dynamic="true">

                <p:tab title="Godfather Part I">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather1.jpg" />
                        <h:outputText
                            value="The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
                            His beloved son Michael has just come home from the war, but does not intend to become part of his father's business. T
                            hrough Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family, kind and benevolent to those who give respect,
                            but given to ruthless violence whenever anything stands against the good of the family." />
                    </h:panelGrid>
                </p:tab>

                <p:tab title="Godfather Part II">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather2.jpg" />
                        <h:outputText value="Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, The_Godfather, parallels the young Vito Corleone's rise with his son Michael's spiritual fall, deepening The_Godfather's depiction of the dark side of the American dream.
                        In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy,
                        killing the local Black Hand Fanucci after he demands his customary cut of the tyro's business. With Fanucci gone, Vito's communal stature grows."/>
                    </h:panelGrid>
                </p:tab>

                <p:tab title="Godfather Part III">
                    <h:panelGrid columns="2" cellpadding="10">
                        <p:graphicImage value="/images/godfather/godfather3.jpg" />
                        <h:outputText value="After a break of more than 15 years, director Francis Ford Coppola and writer Mario Puzo returned to the well for this third and final story of the fictional Corleone crime family.
                            Two decades have passed, and crime kingpin Michael Corleone, now divorced from his wife Kay has nearly succeeded in keeping his promise that his family would one day be completely legitimate."/>
                    </h:panelGrid>
                </p:tab>

            </p:tabView>
        </h:form>
    </h:body>
</html>



I have made one modification to the code from the web site: I enclosed the tabView tags within <h:form> tags. I did this because when I don't, I receive this error:


TabView j_idt6 must be nested inside a form when dynamic content loading is enabled



It makes no difference if the cache is "true" or "false". Is this a bug, or am I missing something obvious?
Sean - WDG
PF 2.2 JSF 2.0 NetBeans 6.9.1 Glassfish 3.0.1 Mojarra 2.0.3


Posts: 15070
Location: Cybertron

Not sure what does wrong, demo seems to be running fine;

http://www.primefaces.org/showcase/ui/t ... ynamic.jsf
PrimeFaces Lead


Posts: 36
Yes, the demo is working just fine. This is why I'm so confused. Using the exact code on my machine, with NetBeans 6.9.1, Glassfish 3.0.1, and Mojarra 2.0.2, I get the error described. Is the demo using the code shown on the screen below it? Because, as I said, when I use this code in my project I get an error. Also, unlike the code shown on the screen, if I don't use <form></form> tags when trying to use dynamic, I get an error - when I put in the <form></form> tags, only the content for the top tab appears, clicking on the other two tabs yields no content.
Sean - WDG
PF 2.2 JSF 2.0 NetBeans 6.9.1 Glassfish 3.0.1 Mojarra 2.0.3


Posts: 15070
Location: Cybertron

Showcase has mojarra 2.0.3, try updating your jsf version.
PrimeFaces Lead


Return to General