Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I get attributes of a component to appear in the final html?

 
Rob Micah
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to incorporate Dojo with my JSF application. Is there a way to get the attributes on a component to be carried through to the final xhtml so that this happens?


 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I gave up on dojo/dijit myself. Dojo was the rage back around 2006, did a fade for several years and right when I got into it and needed support, there wasn't any support worth the name. Although dojo does seem to be having a resurgence now. I find jQuery to be tidier, however. It also works well with JSF. In fact, RichFaces uses it internally.

Don't even think of trying to apply Dojo attributes to JSF tags. They won't be captured, much less passed along, and not all JSF form controls are straight remappings of HTML controls anyway. If you want dojo attributes, you're going to have to use the f:verbatim tag to escape to a raw HTML control.

Dojo really isn't that much of an advantage with JSF anyway. The extension tagsets typically offer their own, more JSF-friendly, AJAX support and the dijit controls generally have JSF extension tag counterparts. Which (in my experience) are better documented and less quirky.

 
Rob Micah
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advice I have seen is to create a custom renderer and tag for this so that's what I've been tinkering with but what are the extension tagsets you're talking about (and their counterparts in dijit)?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A custom renderer is a lot of work. Also, you can't just plug in an alternate renderer if you intend to add new attributes to a tag - you'd need to subclass the tag itself so that it would have a place to store the additional attribute values. This is not something you'll want to do if you have any choice in the matter. It's messy, expensive, and will probably end up having to be completely overhauled come JSF3.

Extension tagsets that can do the kinds of things that dijit do include, but are not limited to:

* JBoss RichFaces
* IceFaces
* Apache MyFaces Tomahawk and its relatives at myfaces.apache.org
* PrimeFaces
* Oracle ADF

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic