1

On the 1st page that is displayed in my JSF application, I want to display data from a database in the form of a table. I have a ManagedBean called a ProductList which has an ArrayList of Product Objects, and I want to put all the Products in a table. I am using the jstl c:forEach tags, but for some reason I get a compile error:

Fatal Error: The prefix "c" for element "c:forEach" is not bound.

Am I using the forEach tag correctly?

<c:forEach items="#{productList.allProducts}" var="product">

</c:forEach>

Here are the namespace tags:

    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html">
user1154644
  • 4,491
  • 16
  • 59
  • 102

1 Answers1

6

You must define all the namespaces(the h:, f:prefixes of your xml tags) that you use in the page.

The proper definition for xmlns:c is xmlns:c="http://java.sun.com/jsp/jstl/core"

You can have a longer example here: <c:if test> seems to always evaluate true in JSF2 Facelets

Community
  • 1
  • 1
SJuan76
  • 24,532
  • 6
  • 47
  • 87