如何将参数传递到ofbiz中的groovy脚本
我是Ofbiz的初学者开发者。 我想使用FreeMarker模板处理一些汽车数据并显示主题。
首先,我单击 carid 单击到一个名为 cardetail 的屏幕,然后我想将其传递给一个groovy脚本,该脚本将查询数据库并发送回一个观察结果。该观察结果将传递给自由标记模板。
我不是问题所在。这是屏幕的代码。
<screen name="carDetail">
<section>
<actions>
<set field="carId" from-field = "parameters"/>
<script location="component://ParcAutomobile/groovyScripts/find.groovy"/>
</actions>
<widgets>
<decorator-screen name="ParcAutomobileCommonDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<platform-specific>
<html>
<html-template location="component://ParcAutomobile/groovyScripts/list.ftl"></html-template>
</html>
</platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
然后,我想通过Groovy进行观察。
carId = parameters.carId
context.carId = carId
car = from("Car").where("carId", carId).queryOne()
context.car = car
最后在freemarker模板中显示它
<div>
<#if car?has_content>
<table>
<tr>
<th>${uiLabelMap.CarId}</th>
<th>${car.carId}</th>
</tr>
<tr>
<th>${uiLabelMap.CarId}</th>
<th>${car.carId}</th>
</tr>
</table>
</#if>
</div>
可以帮助我解决此问题。
I'm beginner Developper in OFBiz.
i want to process some car data and display theme with freeMarker template.
first i send the carId on click to a screen named carDetail i want then to pass it to a groovy script which will query the database and send back one observation. the observation will be pass to a freeMarker template.
I don't where is the problem. here is the code of the screen.
<screen name="carDetail">
<section>
<actions>
<set field="carId" from-field = "parameters"/>
<script location="component://ParcAutomobile/groovyScripts/find.groovy"/>
</actions>
<widgets>
<decorator-screen name="ParcAutomobileCommonDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<platform-specific>
<html>
<html-template location="component://ParcAutomobile/groovyScripts/list.ftl"></html-template>
</html>
</platform-specific>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
then i want to get an observation by doing this with groovy.
carId = parameters.carId
context.carId = carId
car = from("Car").where("carId", carId).queryOne()
context.car = car
finally display it in freeMarker template
<div>
<#if car?has_content>
<table>
<tr>
<th>${uiLabelMap.CarId}</th>
<th>${car.carId}</th>
</tr>
<tr>
<th>${uiLabelMap.CarId}</th>
<th>${car.carId}</th>
</tr>
</table>
</#if>
</div>
help me fix this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论