Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dynamic ui:include difficulties

843844Aug 27 2010 — edited Apr 26 2011
I'm attempting to dynamically include a page based upon a variable value. I'm running my application in GlassFish v3.0.1 and I'm using JSF2 with RichFaces 4. I've read the following articles pertaining to this:

[http://in.relation.to/11633.lace]

[http://devharbor.blogspot.com/2009/08/add-jsf-controls-dynamically-with.html]

and I believe that I have my code correct to work, but I can't seem to get the <c:forEach> tag to work.
<h:panelGroup layout="block">
     <c:forEach var="record" items="#{backer.records}">
          <ui:include src="#{record.page}">
               <ui:param name="paramBean" value="#{record}" />
          </ui:include>
     </c:forEach>
</h:panelGroup>
 
I've got the namespace included for the jstl library:
 
<ui:composition template="layout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
but that gave me the following error when loading the page:

This page contains the following errors:
error on line 16 at column 26: Namespace prefix c on forEach is not defined
Below is a rendering of the page up to the first error.

So I included the jstl namespace in my layout.xhtml template, but that only resulted in the following error message being displayed on my web page.

Warning: This page calls for XML namespace http://java.sun.com/jstl/core declared with prefix c but no taglibrary exists for that namespace.

I've added the following to my pom.xml to ensure that I have the jstl libraries available but it did not seem to have any effect.
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
 
So what am I missing? Why can't I get this to work?

Thanks for the help..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2011
Added on Aug 27 2010
2 comments
485 views