哪个 JSF 组件在非编辑模式下显示文本区域?

Which JSF component to display a text area in non editing mode?

我想显示在两种模式下使用的文本区域:

哪个组件是这种可视化模式的最佳选择?我试过 :

我也尝试过使用 p:outputTextarea 进行编辑和可视化模式,但我会对 p:editor 中提供的更多工具感兴趣。

有什么想法吗?

<p:panel id="panelDG">
        <p:dataGrid id="pdatagrid1" layout="grid" value="#{ib.bloc.groups}" var="group" columns="#{ib.bloc.groupsSize}" rowIndexVar="status">
             <!-- other components -->
               <p:panel styleClass="panel-textarea">
                   <s:account>  
                         <p:editor id="editor1" value="#{ib.textArea1}" rendered="#{status == 0}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo"  />
                         <p:editor id="editor2" value="#{ib.textArea2}" rendered="#{status == 1}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo"  />
                         <p:editor id="editor3" value="#{ib.textArea3}" rendered="#{status == 2}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo"  />
                         <h:panelGrid >
                                <p:commandButton value="Save" action="#{ib.modifyGroupText(group)}"  icon="ui-icon-disk" />
                         </h:panelGrid>
                   </s:account>
                   <s:guest>
                          <h:outputText value="#{group.textArea}" escape="false"></h:outputText>
                   </s:guest>
             </p:panel>
       </p:dataGrid>
</p:panel

.panel-textarea{
height: 500px; 
}

如果你想隐藏 <p:editor> 的工具栏,因为用户没有编辑权限,你可以简单地使用 css.

Facelet

<p:editor styleClass="#{!login.editAccess ? 'hideToolbar' : ''}" disabled="#{!login.editAccess}" ... />

CSS

.hideToolbar .ui-editor-toolbar {
   display: none;
}

哦,我还没有看到 .ui-editor-toolbar class !

否则,使用h:outputText时避免文本溢出:

.h-outputText{
display:block !important;
overflow-y: auto !important;
height: 400px !important;
} 

感谢大家的回答