f:param标签属性'disable'不起作用 [英] f:param tag attribute 'disable' is not work

查看:97
本文介绍了f:param标签属性'disable'不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我的某些情况,我尝试使用<f:param>标记构建带有参数的输出链接URL.

I try to use <f:param> tag to build output link URL with parameters depending on some my conditions.

当我将此标签放在h:output链接中并尝试为禁用"设置不同的值时,我看不到任何效果.

When I place this tag inside h:output link and try to set different values for 'disable' I see no effect.

这是我的代码

<h:outputLink value="/WebApplication10/faces/index.xhtml">
    Link1
    <f:param disable="#{true}" name="name1" value="value1"/>            
    <f:param disable="#{false}" name="name2" value="value2"/> 
</h:outputLink> 

我希望在url中仅看到一个参数,但同时看到两者.

I expect to see only one param in url but I see both.

推荐答案

使用disable="true"代替disable="#{true}"对我有用.

因此,这是标记文档中的错误表示它支持ValueExpressionUIParameter类中的错误,该错误不能将其解析为ValueExpression.我至少为此报告了问题2102 .

So, it's either a bug in the tag documentation that it supports ValueExpression or a bug in the UIParameter class that it does not resolve it as a ValueExpression. I have at least reported issue 2102 for this.

更新:作为临时的解决方法,您可以使用<c:if>来控制在视图构建期间包含<f:param>标记.

Update: As a temporary hack/workaround, you could use <c:if> to control the inclusion of the <f:param> tag during view build time.

<h:outputLink value="/WebApplication10/faces/index.xhtml">
    Link1
    <c:if test="#{!true}"><f:param name="name1" value="value1"/></c:if>
    <c:if test="#{!false}"><f:param name="name2" value="value2"/></c:if>
</h:outputLink> 

请注意,当此代码嵌入到<ui:repeat><h:dataTable>等on的JSF迭代组件中并且test条件取决于迭代变量时,这将行不通.

Note that this is not going to work when this piece is embedded in a JSF iterated component such as <ui:repeat>, <h:dataTable> and on and the test condition depends on the iterated variable.

这篇关于f:param标签属性'disable'不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆