Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can i get component attribute values inside the component

 
Itzik Peretz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have some components of inputText and i want to use the id or the value of the component as a value to other attribute (see the bold part)

<h:inputText id="bsmDNSSearch" value="${(installConfig.bsmDNSSearchDefined) ? installConfig.bsmDNSSearch : this.value}"
disabled="#{installConfig.doNotInstallSMAsBool}" />

Is it possible? In General how can you reference to the component attributes inside the component?

Thanks,

Itzik
 
Christian Nicoll
Ranch Hand
Posts: 106
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In General how can you reference to the component attributes inside the component?

If you build a custom component then this is usually extended from UIComponent class. UIComponent provides a method getAttributes() which gives you a map that represents all your attributes:
http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/javax/faces/component/UIComponent.html
 
Itzik Peretz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I know how to get any attribute in the server side. can I refer to it in the client side?

Itzik
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17628
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your value won't work because an inputText control's value expression must be an lvalue. That means if you can't place the value of the left-hand side (before the "=") of an assignment statement, it's not valid.

You can obtain (and modify) the values of the core JSF controls on the client's browser using client-side code, since the default HTML renderer converts them into ordinary HTML controls. However, accessing them is a little more complicated that accessing straight HTML, since the id attributes of the generated HTML isn't the exact same value as the id you code on the JSF. The generated HTML ids are composites of the JSF ID plus the IDs of the containers that surround it such as the h:form object.
 
Itzik Peretz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, that what i thought, I just wanted to be sure.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic