异常渲染 Qute 模板

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

Exception rendering qute template

问题

  1. 我正在尝试在方法内渲染一个 qute 模板
  2. @ResourcePath("myTpl")
  3. Template tpl;
  4. void generate(Order order) {
  5. tpl.data("order", order).render();
  6. }

模板文件:

  1. {@org.acme.Order order}
  2. <html>
  3. ...
  4. {#for orderProduct in order.getProducts()}
  5. <tr>{orderProduct.getPrice()}</tr>
  6. {/for}
  7. ...
  8. </html>

我面临的问题是:

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

  1. <details>
  2. <summary>英文:</summary>
  3. I am trying to render a qute template inside a method:
  4. ```java
  5. @ResourcePath(&quot;myTpl&quot;)
  6. Template tpl;
  7. void generate(Order order) {
  8. tpl.data(&quot;order&quot;, order).render();
  9. }

The template file:

  1. {@org.acme.Order order}
  2. &lt;html&gt;
  3. ...
  4. {#for orderProduct in order.getProducts()}
  5. &lt;tr&gt;{orderProduct.getPrice()}&lt;/tr&gt;
  6. {/for}
  7. ...
  8. &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:

确定