File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Can I get attributes of a component to appear in the final html? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Can I get attributes of a component to appear in the final html?" Watch "Can I get attributes of a component to appear in the final html?" New topic
Author

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

Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rob Micah
Ranch Hand

Joined: Aug 30, 2011
Posts: 94
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I get attributes of a component to appear in the final html?