简体   繁体   English

禁用jsf标签

[英]disable jsf tag

I need help disabling this link click without using javascript. 我需要在不使用JavaScript的情况下禁用此链接单击的帮助。 So this is a on jsf page where the beans would set a variable to false then the cancel should not be pressable. 因此,这是在jsf页面上,其中Bean将变量设置为false,然后取消不能被按下。

             <p:column style="width:14%; text-align: center;">  
                    <f:facet name="header">  
                        <b><h:outputText value="Action" />  </b>
                    </f:facet> 
                     <a href="cancel.xhtml?id=#{requestClass.requestID}">
                        <h:outputText value="Cancel" />  
                     </a>

                </p:column>  

Thanks in advance! 提前致谢!

Update: 更新:

       <p:column style="width:14%; text-align: center;">  
                    <f:facet name="header">  
                        <b><h:outputText value="Action" />  </b>
                    </f:facet> 
                    <h:link disabled="#{requestBean.cancelledStatus}" 
         outcome="cancel.xhtml?id=#{requestClass.requestID}" value="Cancel">
                         <f:param name="id" value="#{requestClass.requestID}" />
                    </h:link>


                </p:column>  

that didn't actually disable the button when page is loaded even though status of request is cancelled 即使取消了请求状态,页面加载时实际上并没有禁用按钮

Update 2: this error showing when updated to following: 更新2:更新至以下内容时显示此错误:

<h:commandButton value="Cancel" action="cancel.xhtml?id=#{requestClass.requestID}" 
 disabled="#{requestBean.cancelledStatus}">
                        <f:param name="id" value="#{requestClass.requestID}" />
                    </h:commandButton>

it says: 它说:

/pending.xhtml @86,150 action="cancel.xhtml?id=#{requestClass.requestID}" Not a Valid 
Method Expression: cancel.xhtml?id=#{requestClass.requestID}

Instead of using normal HTML tag <a> , you should use JSF's <h:link> . 您应该使用JSF的<h:link>而不是使用普通的HTML标签<a> This tag has the attribute disable that can be used to disable the link. 该标签具有属性disable ,可用于禁用链接。 In you case, it should look like this: 在这种情况下,它应如下所示:

<h:link disable="#{requestClass.disableCancelLink}" outcome="cancel" value="Cancel">
   <f:param name="id" value="#{requestClass.requestID}" />
</h:link>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM