Hi,
I’m koffi a beginner OFBiz developper. I’m facing a problem while developing
car rental Application
I want to do this: I define an entity named “Car" with primary key “carId", and
I would like to display Car informations on a screen named “carDetai"l by
sending the “carId"
There is a screen named “car" in which a put a link to the carDetail with
parameter carId. When a click on this link the parameter will be send to the
screen carDetail which will run groovy script to fetch the corresponding car.
Then the result ( the match car ) will be then send to freeMarker template to
be displayed.
Here is the code:
<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>
The groovy script
carId = parameters.carId
context.carId = carId
car = from("Car").where("carId", carId).queryOne()
context.car = car
freeMarker template
<div>
<#if car?has_content>
<table>
<tr>
<th>${uiLabelMap.CarId}</th>
<th>${car.carId}</th>
</tr>
<tr>
<th>${uiLabelMap.Modele}</th>
<th>${car.modele}</th>
</tr>
</table>
</#if>
</div>
In order to avoid writing all car informations, before be sur it workin, I
just display to value. I expect to get see these informations but a got a blank
page, I don’t know where exactly what is going wrong.
Thanks in advance.
BADJO koffi