1 2 3 4 5 6 7 | < screen name = "ExampleFTL" > < section > < widgets > < label text = "Hello Freemarker" > </ label ></ widgets > </ section > </ screen > |
สร้าง freemarker ขั้นมาหนึ่งไฟล์ใน folder "example/webapp/example/includes" ตั้งชื่อว่า screen.ftl และเพิ่ม โค้ดที่ใช้ในการเรียก Screen Widget ลงไปดังตัวอย่างข้างล่าง
1 | ${screens.render("component://example/widget/example/ExampleScreens.xml#ExampleFTL")} |
ลองเรียก FTL screen ดูโดยให้เพิ่มโค้ดการเรียกใช้ ftl ใน screen widget ตามตัวอย่างข้างล่าง
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | < screen name = "FindExample" > < section > < actions > < set field = "headerItem" value = "Example" > < set field = "titleProperty" value = "PageTitleFindExample" > </ set > < widgets > < decorator-screen location = "${parameters.mainDecoratorLocation}" name = "main-decorator" > < decorator-section name = "body" > < section > < condition > < if-has-permission action = "_VIEW" permission = "EXAMPLE" ></ if-has-permission > </ condition > < widgets > <!-- แทรก Code นี้ลงไป --> < platform-specific > < container >< label >${uiLabelMap.${titleProperty}}</ label ></ container > < container > < link target = "EditExample" text = "${uiLabelMap.ExampleNewExample}" /></ container > < include-form location = "component://example/widget/example/ExampleForms.xml" name = "ListExamples" ></ include-form > </ platform-specific > < fail-widgets > < label >${uiLabelMap.ExampleViewPermissionError}</ label > </ fail-widgets > </ widgets > </ section > </ decorator-section > </ decorator-screen > </ widgets > </ set ></ actions ></ section ></ screen > |
start OFBiz และเข้าไปยัง Example Component แล้วคลิก Example ได้ผลอย่างไรมาบอกกันด้วยนะครับ
อ้างอิง : www.ofbizguru.com
0 comments:
Post a Comment