Ofbiz-groovy-freemarker

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.