码迷,mamicode.com
首页 > 其他好文 > 详细

OFBiz进阶之HelloWorld(三)使用 Form Widget

时间:2014-09-24 01:29:55      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   使用   ar   for   div   

1. Now add one more menu item to by name "PersonForm" to your PracticeMenus.xml file.

<menu-item name="PersonForm" title="PersonForm">
<link target="PersonForm" />
</menu-item>

 

2. Create one file in widget by name PracticeForms.xml and create a list form for showing the records from person entity.

    (Take reference from ExampleScreens.xml and ExampleForms.xml files).

<?xml version="1.0" encoding="UTF-8"?>
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
    <form name="ListPersons" type="list" list-name="persons" list-entry-name="person"  default-map-name="person" paginate-target="personForm">
        <!-- Important: Here service definition for updatePracticePerson has been used for automatically rendering the form fields, which you can use after completing CRUD operations from Part-3 -->
         <!-- auto-fields-service service-name="updatePracticePerson" default-field-type="display" map-name="person"/-->
 
         <!-- The above method can be used in case a service specific form is being rendered, otherwise form-fields can be explicitly mentioned as given below:-->
         <field name="firstName"><display/></field>
         <field name="middleName" ><display/> </field>
         <field name="lastName" ><display/> </field>
    </form>
</forms>

 

3. Create new screen by name personForm and include this list form in it.

<screen name="PersonForm">
        <section>
            <actions>
                <set field="headerItem" value="personForm"/>
                <set field="titleProperty" value="PageTitlePracticePersonForm"/>
                <entity-condition entity-name="Person" list="persons"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonPracticeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <label text="Person List" style="h2"/>
                        <include-form name="ListPersons" location="component://practice/widget/PracticeForms.xml"></include-form>
                    </decorator-section>
                </decorator-screen>       
            </widgets>
        </section>
</screen>

4. Do the needful for showing this screen in controller.xml.

Now run the application again and observe the difference.
Till Now you have worked on controller requests mappings, Screen widget, form widget, Decorator, Menus, groovy, ftl.

OFBiz进阶之HelloWorld(三)使用 Form Widget

标签:style   blog   http   color   io   使用   ar   for   div   

原文地址:http://www.cnblogs.com/yanchuanblog/p/3989649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!