• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read attributes of JSF component in javascript part

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
https://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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic