Kevin Bruccoleri
Kevin Bruccoleri

Reputation: 364

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>

Upvotes: 2

Views: 170

Answers (1)

Surreal
Surreal

Reputation: 1047

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

Upvotes: 2

Related Questions