javagroovyplayframeworkplayframework-1.x

Importing Java classes into Groovy template (Play framework 1.x)


Is it possible to import Java classes into a Groovy template while using Play framework to avoid using fully qualified paths?

Current:

<div>
    *{ Loop through enum values.}*
    #{list items:package1.package2.package3.SampleEnum.values, as:'enumValue'}
        ...
    #{/list}
</div>

Desired:

%{
    import package1.package2.package3.SampleEnum 
}%
<div>
    *{ Loop through enum values.}*
    #{list items:SampleEnum.values, as:'enumValue'}
        ...
    #{/list}
</div>

Solution

  • In my experience, sadly not. You could set the enum values in a different template and inherent those separate friendly named values but that is just a hack.

    PS miss you