-
1. Re: Simple question, tough answer about SelectItems
igx89 Oct 24, 2007 1:02 PM (in response to dhinojosa)Create a stateless Seam component with a method that takes a float as a parameter and returns it as a formatted currency string.
For example, if you named the component "formatter" and named the method "asCurrency(float currency)", then your label attribute would be:
label="#{sale.name} - #{formatter.asCurrency(sale.getSubtotal(calendarBean))}" -
2. Re: Simple question, tough answer about SelectItems
dhinojosa Oct 24, 2007 1:26 PM (in response to dhinojosa)Woot! Thanks...
I was going into a long divergent path.
I was thinking though through this problem that all basic converters should be accessible as a seam component. That way they can be accessed as tags or through EL. Also a standard value holder component would be a good idea too. -
3. Re: Simple question, tough answer about SelectItems
pmuir Oct 24, 2007 1:37 PM (in response to dhinojosa)Dan, thats not a bad idea e.g. exposed as #{converters['javax.faces.NumberConverter'} - you should file a feature request.
Matthew, I would suggest using an el function rather than a seam component - separates the view and backing layer better. -
4. Re: Simple question, tough answer about SelectItems
igx89 Oct 24, 2007 2:38 PM (in response to dhinojosa)I've heard of EL functions, but the Seam documentation doesn't mention them and the stuff Google brings up seems specific to JSP and not Facelets, so I really have no idea how to create them. Do you know of any good tutorials/documentation on using them with Facelets and/or Seam?
-
5. Re: Simple question, tough answer about SelectItems
pmuir Oct 24, 2007 2:44 PM (in response to dhinojosa)As usual, Rick Hightowers facelets series are excellent:
[url]http://www.ibm.com/developerworks/java/library/j-facelets2.html#N100B9[/url
Although I prefer to register the functions using xml rather than code. -
6. Re: Simple question, tough answer about SelectItems
igx89 Oct 24, 2007 3:09 PM (in response to dhinojosa)Thanks. Is there a link on how to register the functions using xml too? Because from looking at that tutorial, it's a lot more complex and error-prone than the way I'm doing now.
-
7. Re: Simple question, tough answer about SelectItems
pmuir Oct 24, 2007 3:26 PM (in response to dhinojosa)Facelets docs do discuss this afaik