异常渲染 Qute 模板

huangapple 未分类评论51阅读模式
英文:

Exception rendering qute template

问题

我正在尝试在方法内渲染一个 qute 模板

@ResourcePath("myTpl")
Template tpl;

void generate(Order order) { 
   tpl.data("order", order).render(); 
}

模板文件:

{@org.acme.Order order}

<html>
...
{#for orderProduct in order.getProducts()}
   <tr>{orderProduct.getPrice()}</tr>
{/for}
...
</html>

我面临的问题是:

[error]: Build step io.quarkus.qute.deployment.QuteProcessor#analyzeTemplates threw an exception: java.lang.IllegalArgumentException: Not a virtual method: *(orderProduct


<details>
<summary>英文:</summary>

I am trying to render a qute template inside a method: 

```java
@ResourcePath(&quot;myTpl&quot;)
Template tpl;

void generate(Order order) { 
   tpl.data(&quot;order&quot;, order).render(); 
}

The template file:

{@org.acme.Order order}

&lt;html&gt;
...
{#for orderProduct in order.getProducts()}
   &lt;tr&gt;{orderProduct.getPrice()}&lt;/tr&gt;
{/for}
...
&lt;/html&gt;

The issue that I am facing:

[error]: Build step io.quarkus.qute.deployment.QuteProcessor#analyzeTemplates threw an exception: java.lang.IllegalArgumentException: Not a virtual method: *(orderProduct

Thanks.

答案1

得分: 0

理想情况下,请提交一个新的问题并附上一个最小的重现案例。别忘了提到 Quarkus 版本。顺便说一句,您应该能够使用 {#for orderProduct in order.products}{orderProduct.price}(无需参数 -> 无需使用括号)。

英文:

Ideally, file a new issue and attach a minimal reproducer. And don't forget to mention the Quarkus version. BTW you should be able to use {#for orderProduct in order.products} and {orderProduct.price} instead (no param -> no need to use the parentheses).

huangapple
  • 本文由 发表于 2020年4月4日 21:05:27
  • 转载请务必保留本文链接:https://java.coder-hub.com/61028534.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定