Hi Koffi,

I suppose that you have used/followed https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide+for+18.12 to create your component

Anyway, your reasoning sounds good, and not looking at all details, at 1st 
glance your code sounds enough for a start.
For instance I suppose list.ftl is in the groovyScripts folder in ParcAutomobile, where it should not be but in a template folder, but let's suppose that's OK.

So you have a request-map in your ParcAutomobile controller, called from the 
car screen, and you pass the carId parameter to the carDetail screen.

Then, what do you see in console.log?

If you did not already, I recommend you to read/view this page https://cwiki.apache.org/confluence/display/OFBIZ/Framework+Introduction+Videos+and+Diagrams when you get time,
particularly 
https://cwiki.apache.org/confluence/download/attachments/7045155/18ArtRefDia.pdf?version=1&modificationDate=1267053493000&api=v2
Of course BSH is now Groovy.

HTH

Jacques

Le 12/06/2022 à 01:05, Dibe koffi a écrit :
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


Reply via email to