Using c:forEach with Seam, JSF, and Facelets

After a couple of hours of scratching my head and Googling the Interwebs like a mad man I finally figured out why my c:forEach wasn’t iterating and displaying the data in my view. Come to find out I was using the wrong name space when declaring the JSTL core library.

First off here is the c:forEach code.

1
2
3
4
<c:forEach items="#{item.tags}" var="tag">
  <h:outputText value="#{tag.name}"/>
  <br/>
</c:forEach>

Here is the incorrect name space causing the issues. Notice the word jsp in the path.

1
xmlns:c="http://java.sun.com/jsp/jstl/core"

Now for the correct name space. Just remove the word jsp from the path.

1
xmlns:c="http://java.sun.com/jstl/core"

Bingo. Now everything is working. Don’t make same boneheaded mistake.



Comments

  1. Dennis April 8th

    Comment Arrow

    Thank you sooooo much.
    I had the same problem for the same reason. And after googling for hours, I finally found you page. Thanks!


  2. Brian April 8th

    Comment Arrow

    Dennis,

    You are very welcome. Glad to know it helped somebody. This issue threw me for a loop because the other namespace is valid but just doesn’t work.


  3. Kevin July 29th

    Comment Arrow

    Thank u very much! That helps me a lot!


  4. Brian July 29th

    Comment Arrow

    You are welcome Kevin. Glad it saved you some time.


  5. Larry October 29th

    Comment Arrow

    Thx a lot!


  6. Brian October 30th

    Comment Arrow

    You are welcome Larry.


  7. Meed December 1st

    Comment Arrow

    Thanks, I had the same problem. I think one release of Seam was wrongly setting this url by (seam-gen)


  8. Brian December 1st

    Comment Arrow

    You are welcome Meed.


  9. Konrad November 9th

    Comment Arrow

    I know this is an old post, but I want to thank you for saving me a lot of time!


  10. Brian November 9th

    Comment Arrow

    Konrad – Glad it helped.


  11. Max November 22nd

    Comment Arrow

    You’re a life saver brian. tnx. I’ve been working on the same problem for 3 days now. And to think that’s the root cost.


  12. Brian November 22nd

    Comment Arrow

    Your welcome Max. Glad it helped.


Add Yours

  • Author Avatar

    YOU


Comment Arrow



About Author

Brian

Brian Abston is an IT Manager in Oklahoma that also still gets his hands dirty and writes code.