Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rendered problem

 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instantiate the property itself. Do not create a new one.
 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, how do it Instantiate the property itself? is it like this: HtmlOutputText outputText3; ?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, it works now.
Thanks for your help
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic