2016-06-14 165 views
-1

你好,我有以下代码:看不到输入标签在JSF

<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”到这个输入。任何人都知道如何去做?

谢谢。

+0

选择后,它仍然是一个自动完成字段。如果您键入错误,则必须能够键入另一个值。只读不会允许这个。 – Holger

+0

目前的问题标题非常混乱,因为它与目前提供的信息相矛盾。 – BalusC

回答

0

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

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

请确保它是正确的。

+0

但是当我设置disabled =“true”时,文本输入和按钮选择这两个位置中的一个将变灰。我只想让输入变灰,我仍然可以选择其中一个位置。 – sirDexter