Meaningless Drivel is fun!*
The moose likes JSF and the fly likes Read attributes of JSF component in javascript part Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Read attributes of JSF component in javascript part" Watch "Read attributes of JSF component in javascript part" New topic
Author

Read attributes of JSF component in javascript part

Petr Dusek
Greenhorn

Joined: Nov 26, 2012
Posts: 23
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

Joined: Jun 25, 2001
Posts: 15958
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Petr Dusek
Greenhorn

Joined: Nov 26, 2012
Posts: 23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Read attributes of JSF component in javascript part
 
Similar Threads
Srping+Hibernate bad configurated causing huge memory consumption
Setting "rendered" attribute via javascript?
How to allow null to an object attribute?
Griffon and Grails
protected acces modifier