在JSF中看不到输入标记

时间:2016-06-14 09:56:09

标签: jsf primefaces

您好我有以下代码:

<ui:composition
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:pe="http://primefaces.org/ui/extensions">

            <h:panelGroup id="typKlienta_wrapper" class="rowWrapper #{customWrapperClass}" layout="block" >
                <h:panelGroup rendered="#{visibilityComponent.isVisible(formComponent.current, userClassHelper.typKlientaProperty)}">
                    <h:outputText escape="false" styleClass="rowWrapperLabel #{userService.getLabelClass(userClassHelper.typKlientaProperty)}" for="typKlienta" id="typKlienta_label" value="#{messages.get('label.typKlienta')}:" />
                    <div class="rowWrapperValue">
                        <h:panelGroup>
                            <p:autoComplete styleClass="reference #{customStyleClass}" disabled="#{formComponent.preview or not userService.hasChangePermission(userClassHelper.typKlientaProperty)}" name="typKlienta" id="typKlienta" value="#{formComponent.current.typKlienta}" dropdown="true" completeMethod="#{typKlientaConverter.getValues}" var="item" itemLabel="#{baseObjectUtil.getSingleLabel(item)}" itemValue="#{item}" converter="#{typKlientaConverter}" forceSelection="true" scrollHeight="250" groupBy="#{typKlientaConverter.getGroup(item)}" >
                                <p:ajax event="itemSelect" execute="@this" listener="#{userService.processAjaxBehavior}"  />
                                <h:outputText escape="false" value="#{baseObjectUtil.getSingleLabel(item)}" />
                                <f:facet name="itemtip">  
                                    <h:panelGrid columns="2" cellpadding="5">  
                                        <f:facet name="header">  
                                            <h:outputText escape="false" value="#{baseObjectUtil.getSingleLabel(item)}" />
                                        </f:facet>
                                        <p:column>
                                            <h:outputText rendered="#{typKlientaService.hasListPermission(typKlientaClassHelper.nazwaProperty)}" value="#{messages.get('column.label.nazwa')}" />
                                        </p:column>
                                        <p:column>
                                            <h:outputText rendered="#{typKlientaService.hasListPermission(typKlientaClassHelper.nazwaProperty)}" escape="false" value="#{item.nazwa}" />
                                        </p:column>
                                        <p:column>
                                            <h:outputText rendered="#{typKlientaService.hasListPermission(typKlientaClassHelper.grupyCenoweProperty)}" value="#{messages.get('column.label.grupyCenowe')}" />
                                        </p:column>
                                        <p:column>
                                            <h:outputText rendered="#{typKlientaService.hasListPermission(typKlientaClassHelper.grupyCenoweProperty)}" escape="false" value="#{baseObjectUtil.getSingleLabel(item.grupyCenowe)}" />
                                        </p:column>
                                    </h:panelGrid>  
                                </f:facet>  
                            </p:autoComplete>
                            <p:commandButton styleClass="btn-menu" icon="ui-icon-gear" id="typKlienta_actionButtons" type="button" />
                            <p:menu overlay="true" trigger="typKlienta_actionButtons" my="left top" at="left bottom">  
                                <p:menuitem styleClass="mi-create" rendered="#{not formComponent.preview and userService.hasCreatePermission(userClassHelper.typKlientaProperty)}" icon="ui-icon-document" action="#{userFormHelperComponent.createTypKlienta}" value="#{messages.get('actions.create')}" update="#{idComponent.editRender}" />
                                <p:menuitem styleClass="mi-edit" rendered="#{not formComponent.preview and userService.hasEditPermission(userClassHelper.typKlientaProperty) and not userFormHelperComponent.typKlientaUnlinked}" icon="ui-icon-pencil" action="#{userFormHelperComponent.editTypKlienta}" value="#{messages.get('actions.edit')}" update="#{idComponent.editRender}" />
                                <p:menuitem styleClass="mi-preview" rendered="#{userService.hasPreviewPermission(userClassHelper.typKlientaProperty) and not userFormHelperComponent.typKlientaUnlinked}" icon="ui-icon-clipboard" action="#{userFormHelperComponent.previewTypKlienta}" value="#{messages.get('actions.preview')}" update="#{idComponent.editRender}" />
                                <p:menuitem styleClass="mi-unlink" rendered="#{not formComponent.preview and userService.hasDeletePermission(userClassHelper.typKlientaProperty) and not userFormHelperComponent.typKlientaUnlinked}" icon="ui-icon-minus" action="#{userFormHelperComponent.unlinkTypKlienta}" value="#{messages.get('actions.unlink')}" update="#{idComponent.editRender}" />
                            </p:menu>

                        </h:panelGroup>
                    </div>
                    <h:panelGroup id="typKlienta_message" layout="block">
                        <h:panelGroup layout="block" class="rowWrapperMessage #{userService.getMessageClass(userClassHelper.typKlientaProperty)}" rendered="#{userService.hasMessage(userClassHelper.typKlientaProperty)}">
                            <span class="#{userService.getMessageIconClass(userClassHelper.typKlientaProperty)}"></span>
                            <h:outputText escape="false" value="#{userService.getMessageValue(userClassHelper.typKlientaProperty)}" />
                            <p:dataList styleClass="value-quickFix" rendered="#{userService.hasQuickFixes(userClassHelper.typKlientaProperty)}" value="#{userService.getQuickFixes(userClassHelper.typKlientaProperty)}" var="quickFix">  
                                <p:commandLink styleClass="quickFix" tabindex="-1" update="#{idComponent.editRender}" actionListener="#{userService.quickFix(userClassHelper.typKlientaProperty, quickFix)}" value="#{quickFix}" />
                            </p:dataList>  
                        </h:panelGroup>
                    </h:panelGroup>
                </h:panelGroup>
            </h:panelGroup>

</ui:composition>

此代码显示以下窗口:

Window image

当我选择这两个位置中的一个时,我可以在输入中编辑它。我遇到的问题是代码中没有输入标记,但它在代码检查中显示为输入。我想在这个输入中添加readonly =“true”。有谁知道怎么做?

感谢。

1 个答案:

答案 0 :(得分:0)

你的意思是代码中没有输入标记。 <p:autoComplete>是输入标记。如果未禁用,则表达式for disable的计算结果为false

disabled="#{formComponent.preview or not userService.hasChangePermission(userClassHelper.typKlientaProperty)}"

确保它是正确的。