Search code examples
formsjsfjavabeans

How do I set the value of HtmlOutputText in JSF?


I want to dynamically create a form with my bean. I am using JSF 2.0

HtmlOutputText htmlOutputText = new HtmlOutputText();

How should I set the content of HtmlOutputText?


Solution

  • HtmlOutputText extends javax.faces.component.UIOutput.

    UIOutput#setValue() is the method you are looking for:

    String value;
    HtmlOutputText htmlOutputText = new HtmlOutputText();
    htmlOutputText.setValue(value);
    

    Links: