Provided sample application - CreateMethod.zip is based on standard HR schema, two tables are used - COUNTRIES and REGIONS. First table is used for Create operation, second is a source for a LOV component. So, developed application can be used to insert countries data into a table from HR schema.
While developing Create form, at first I have used simple drag and drop method to create two af:inputText and one af:selectOneChoice components. Those components were created without binding to Data Control. After that I have declared in page definition file three variables and generated attributeValue elements for them. When described steps were done, values of components available in JSPX page were binded to elements defined in page definition file. For example, for Country ID value binding is equal to: #{bindings.countryIdAttr.inputValue}, where countryIdAttr is generated attributeValue element. Page definition file structure:
When components and page definition were created, I have developed create method code in Application Module class. Method code is rather simple, it acquires definition for Countries entity and opens transaction. After that, new instance of Countries entity is initialized by values submited from ADF Faces components available in JSPX page. If there is no exceptions, data for new row is commited to the database. Create method code:
When method code is created, don't forget to add method signature into Application Module client interface. This will allow to call created method from JSPX page.
And, my last step was to drag and drop createCountry(String, String, Number) from Data Controls palette to af:panelForm footer facet. Method parameters should be binded to variables defined in page definition file. Data Controls palette for this sample:
af:panelForm component contains two af:inputText, one af:selectOneChoice and one af:commandButton:
Finally, Create form in action:
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.