jenkinsjelly

Jelly - how to call java method with parameters from jelly tag


I have the following entry in my .jelly file:

<j:forEach items="${instance.getVerdictCategoriesList()}" var="p">
    <f:entry title="${%Started}"                             
             field="${p.verdictValue}">
             <f:textbox name="${p.verdictValue}"
                        value="${instance.returnDefaultZeroValue()}"
                        default=""/>
    </f:entry>

Currently I'm calling the ${instance.returnDefaultZeroValue()} and it works.

I want to call a method with multiple parameters. How do I do that?

Like: value="${instance.getGerritReportingValueForCustomLabel(${p.verdictValue})}" but that fails with a "can't parse jelly" error.


Solution

  • I suppose you meant

    value="${instance.getGerritReportingValueForCustomLabel(p.verdictValue)}"
    

    The ${…} syntax introduces interpolation of JEXL expressions into what would otherwise be treated as a literal string. It is not part of JEXL itself.