OFBiz advanced helloworld (3) using form widgets

Source: Internet
Author: User

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 advanced helloworld (3) using form widgets

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.