Tag: Jsf

Facelets Template Includes and Params

Facelets is a great template framework that sits on top of JSF. They have some fun template includes and parameters that you can pass into the included templates. Here is an example with one gotcha pertaining to the parameter name.

Create Custom Facelets Component

Facelets is a great addition to jsf. It is very extensible, and it makes creating custom components even easier. It’s fantastic. This is almost TOO easy. If you have a pile of view markup and/or client-side logic, then this is a good option. And by good, I mean awesome.

Loop Index in ui:repeat

Sometimes it’s useful to know what the invariant value is for your loop within a facelets loop. I use ui:repeat a lot, but have seen some problems with it in the past. If you want to get the loop index for your ui:repeat, you may be disappointed. Basically, it requires that you use a different looping mechanism. A nice alternative is the a4j:repeat, which offers the same functionality, plus more awesomeness…

JSF ValidationError with Custom Converters

Here’s an important tidbit… JSF does not give any default validators for your data if you use a custom converter. If you’re getting a ValidationError exception, overriding equals and hashcode methods might be a good idea. For more, read on…

JSF Won't Submit Null in ui:repeat

It stinks when your jsf components don’t do what they’re supposed to or even what they usually do. This was the case with my h:inputText field when trying to submit a null value – but! only within a ui:repeat component.

JSF Modal Goodness

Meet the new web. The simpler the better. The cleaner the better. The more pleasing the colors the better. The fuzzier feelings the better. The latest fuzzies have been brought on by a slew of modals. Previously, we haven’t used many modals in our layouts and designs, so here’s the first working pattern on how to get this kind of stuff working.

This solution allows content to appear in a modal, validation errors to post back to the modal, edits made in a modal to persist back to the database, and success messages to appear on parent page.

Null SelectItem Option

Sometimes it’s desirable to be able to have a null or “none of these” option for a dropdown. I’ve gotten tripped up on the syntax a couple times and have found enough variance in “solutions” listed on forums that I’ll just add to the mix and record what works well for me here.

Id's from JSF, used in jQuery

For our view layer on our current project at work, we use JSF/Facelets + some jQuery goodness. I have found that at some times these two tech’s have a hard time working with each other. I ocassionally have problems with the id’s. Here’s a nice little way to guarantee you id’s are awesome.

ManyToMany Relationships in JSF

What a journey of discovery! I haven’t done much many-to-many relationship management in JSF. Django makes it quite easy. But at work recently, I did it in JSF. It was quite the experience, hereafter chronicled.