JSF 2.2 Primefaces 5.0 Managed Bean

我只想做一件简单的事:

我想使用托管bean在JSF站点中呈现一个primefaces组件 .

JSF:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>BeanTest</title>
    </h:head>
    <h:body>

        #{testBean.output}

    </h:body>
</html>

托管bean:

public class TestBean {

    /**
     * Creates a new instance of TestBean
     */
    public TestBean() {
    }

        private String output = "<p:calendar mode=\"inline\"/>";

    /**
     * Get the value of output
     *
     * @return the value of output
     */
    public String getOutput() {            
        return output;
    }

    /**
     * Set the value of output
     *
     * @param output new value of output
     */
    public void setOutput(String output) {
        this.output = output;
    }
}

结果是文本 <p:calendar mode="inline"/> .

如何渲染primefaces组件?

如果我以常规方式使用它(bean只设置primefaces组件的属性),一切正常 .