f:param tag attribute 'disable' is not work
Asked Answered
C

2

6

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.

Counselor answered 9/6, 2011 at 20:18 Comment(0)
F
12

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.

Fathom answered 9/6, 2011 at 20:33 Comment(2)
I updated the answer to include a temporary hack/workaround. You could use it until the Mojarra guys have fixed the issue.Fathom
FYI: this is fixed since Mojarra 2.1.15. More than 1.5 years later :/Fathom
C
4

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

Cherisecherish answered 11/7, 2012 at 21:27 Comment(1)
Better yet, use both, so your application continues to work when it runs on a fixed version of Mojarra.Standoff

© 2022 - 2024 — McMap. All rights reserved.