首页 > 其他 > 详细

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

时间:2014-09-24 01:11:06      阅读:539      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!