f:param tag attribute 'disable' is not work

ⅰ亾dé卋堺 提交于 2019-12-05 00:28:56

问题


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

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

Here the my code

<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> 

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


回答1:


Using disable="true" instead of disable="#{true}" works for me.

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.


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> 

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.




回答2:


Use 'disble' instead 'disable'. The reason is described here: http://markmail.org/message/bmb2lek5mcx4ofp7



来源:https://stackoverflow.com/questions/6298742/fparam-tag-attribute-disable-is-not-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!