aspose file tools*
The moose likes JSF and the fly likes rendered problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "rendered problem" Watch "rendered problem" New topic
Author

rendered problem

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
I tried to do a render for outputText component, but i just can get it right. Below is the code that i wrote.

Bean class:


jsp page


The text is always been shown even if i have set "outputText3.setRendered(false);"
Did i do set the rendering correctly? Where have i gone wrong.

Thanks.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You didn't bind the outputtext to the backing bean. You can use the component's 'binding' attribute for this.

And you should be using the same instance and not creating a new instance inside the checkUpgrade() method.
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
i have set the binding attribute="#{SCBean.outputText3}" but it doesnt work.
If i remove the new instance. i have the following error:

javax.faces.FacesException: Can't instantiate class: 'view.backing.SCBean'.. class view.backing.SCBean : java.lang.NullPointerException
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Instantiate the property itself. Do not create a new one.
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
sorry, how do it Instantiate the property itself? is it like this: HtmlOutputText outputText3; ?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Just
or lazily

Point is that you should use the property as reference and not to create a new one which is not related to any property at any way.
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
ok, it works now.
Thanks for your help
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You're welcome.
 
 
subject: rendered problem