Forums Register Login

How to put EL into setRendered()?

+Pie Number of slices to send: Send
I need to set visibility of an UIInput component programmatical and with a binding:

<h:inputText rendered="#{mybean.visisble}" />

uiInput.setRendered(boolean); doesn't do the job.

Instead I tried:


It doesn't work.
+Pie Number of slices to send: Send
 

Originally posted by Sasha Baker:
I need to set visibility of an UIInput component programmatical and with a binding:

<h:inputText rendered="#{mybean.visisble}" />

uiInput.setRendered(boolean); doesn't do the job.

Instead I tried:


It doesn't work.



I suggest that instead of doing:
rendered="#{mybean.visisble}"
do:
binding = "{BB.inputText}"


Then in the backing bean on some condition activate the inputText
example:
BB:
HtmlInputText inputText = new HtmlInputText();

constructor(){
inputText.setRendered(false);
}
public void someMethod(){
inputText.setRendered(false);
}

If you look at the JSF documentation you will see that when the object property is changed JSF will re-render the object. The way you have done it the re-render will not occur. Hope this helps.
+Pie Number of slices to send: Send
Thank you for your help!

I was trying to build something like this from java code:



The ValueExpression as described above works well. My fault was to use
.setValue("#{bean.visible}");, which neither works nor results in an error message, as setValue expects a plain Object. But the String isn't parsed
as an expression value. Instead one must call .setValueExpression("value", vExp) too.

To give a more complete source example for the use of ValueExpression:


[ November 27, 2008: Message edited by: Sasha Baker ]
Men call me Jim. Women look past me to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 7013 times.
Similar Threads
Converting a javascript variable to Java variable.
AddActionListener From parameter as exression
binding and rendered attribute
How to create BINDING of command link with backing bean
rendered attribute of output
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:12:29.