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.



Using jQuery with Seam

If you are using RichFaces with your Seam application then jQuery is already there and ready to use. The only thing to remember is to use jQuery() function to refer to jQuery rather than using $(). $() is used to refer to prototype.js functions which RichFaces uses heavily.

Below is an example you can use to test jQuery. This should pop up a box on your page.

1
2
3
4
5
<script type="text/javascript" >
  jQuery(document).ready(function() {
      alert("hello seam: " + jQuery(window).height());
  });
</script >

For more information on jQuery and RichFaces check out the RichFaces Live Demo page.



Gavin King on Contexts and Dependency Injection, Weld, Java EE 6

DZone spoke with Gavin King, JBoss Fellow at Red Hat, earlier this week to discuss the newly ratified JSR 299 (Contexts and Dependency Injection) specification as well as Java EE 6 (JSR 316), both of which passed their final approval ballots on Nov 30th, 2009. In this exclusive interview, Gavin describes the evolution of the CDI specification (formerly known as Web Beans) and describes some of its primary goals. He also talks about the several CDI implementations currently on the market, including JBoss’ own Weld implementation, and also highlights some of the benefits of running Weld can inside a servlet container, or in a Java SE environment. Finally, Gavin previews what we can expect to see in Seam 3, and points out the vast improvements that have been made in JSF 2 — he also encourages JSF skeptics to “take a second look.”

Full transcript can be found at DZone.



Next

Prev