[jboss-user] [JBoss Seam] - Re: EL enhancements

lightbulb432 do-not-reply at jboss.com
Tue Feb 20 19:05:20 EST 2007


Here's the type of thing I'm trying to do. The point is that there are a list of "favorites", and within that list I want to specially mark those favorites of the logged in user.

But of course, the enhanced EL expression I have in the view doesn't work. It seems like the most intuitive way to do it, but I guess I have to look for another option.

Hopefully you can advise as to what I can do here. Thanks.

@DataModel
  | private List favorites;
  | 
  | @Factory
  | public void getFavorites() {
  |   favorites = entityManager.createQuery("...").getResultList();
  | }
  | 
  | public String getStatus(int id) {
  |   for (Favorite f : member.getFavorites()) {
  |     if (member.getFavorite().getId() == id) return "Your Favorite";
  |   }
  |   return "Not Your Favorite";
  | }

<h:dataTable value="#{favorites}" var="fave">
  |   <h:column>
  |     #{fave.name}
  |   </h:column>
  |   <h:column>
  |     #{entityHome.status(fave.id)}
  |   </h:column>
  | </h:dataTable>

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019616#4019616

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019616



More information about the jboss-user mailing list