• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read attributes of JSF component in javascript part

 
Petr Dusek
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I am developing a component based on ice:inputRichText. I would like to do this:


I have changed the config.js and added some plugins. But I want to acces the attributes of the tag from the plugins. It is not possible - If I try to acces the attributes (getElementByID method), it throws a cryptic error.

Should I use the jQuery?
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a general rule I recommend using the XML component builder of JSF instead of trying to construct (or subclass) a binary component. They're easier to do and less likely to get broken due to future changes to JSF's internal architecture. JSF has a lot of evolving to do yet.

Sometimes there's no help for it, though, and you have to go binary.

In JSF2, the attributes are kept in a map that's part of the JSF element implementation, so you don't set/get them directly. As for the sordid details, I'll have to refer you to the documentation, since I have few examples lying around and none I've worked on recently. However, do pay attention when overriding any inherited attributes to the difference between direct values and EL expressions. If the attribute can be an EL expression, you have to manage the process yourself.
 
Petr Dusek
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show me please some examples? How to use XML component builder of JSF?

I posted there, what I really want
http://www.coderanch.com/t/605477/JSF/java/JSF-tag-structure

I mean, it is possible to extend a rendere (do something like this: http://stackoverflow.com/questions/6859520/adding-custom-attribute-html5-support-to-jsf-2-0-uiinput-component
http://jetcracker.wordpress.com/2012/10/30/jsf-2-overriding-renderer-how-to-add-custom-attributes-to-component/)

Then I would like to acces the attributes (or inner tag structure) via javascript (document.getElementById etc.)

Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic