Ofbiz-groovy-freemarker into different pages depending on the browser's address
Step One: (2 Select) Create a groovy file, or a Java file. Define variables in the file to be placed in the
Request.setattribute easy to find in the Jump page, you can do some validation in this class or the method of adding and deletions, you can customize the return value.
Step two: In the Controller.xml file, define the address of the path access Request-map and View-map view file
Specific operation:
<request-map uri= "Text" >
<event type= "Groovy" path= "Component://ykd/webapp/ykd/web-inf/actions/party/text.groovy"/>
<response name= "Success" type= "View" value= "Text"/>
</request-map>
<view-map name= "text" type= "screen" page= "Component://ykd/widget/commonscreens.xml#text"/>
Note that the type in the event tag can be Java I am referencing a file that is groovy type path:component://file specific address
Text.groovy File Contents:
Request.setattribute ("name", "Ultraman");
def books = [];
Books[0] = ["name": "Getting Started with Java", "Price": 85];
BOOKS[1] = ["Name": "Java Combat", "price": 70];
BOOKS[2] = ["Name": "Java Intermediate", "price": 63];
BOOKS[3] = ["Name": "Java Advanced", "Price": 81];
Request.setattribute ("Books", books);
Return "Success";
View-map make a selection into that view file type is screen Note: Ykd/widget/commonscreens.xml#text #号前面是所在的文件 #后面代表文件中的
A <screen name= "text" > tag tag named text in <screen name= "text" > tags in the
<screen name= "Text" > Label display:
<screen name= "Text" >
<section>
<actions>
</actions>
<widgets>
<platform-specific>
</platform-specific>
</widgets>
</section>
</screen>
Step three: The FTL tab can be tagged with the jap tag or freemarker
FTL page Content:
Your name:<b>${requestattributes.name}</b>.
<table border= ' 1 ' >
< #list Requestattributes.books as book>
<tr>
<td>${book.name}</td>
<td>${book.price?if_exists}</td>
</tr>
</#list >
</table>
The steps can be inconsistent. It doesn't matter to write according to your own ideas.
Ofbiz-groovy-freemarker