However part-way through I realised that this wasn't making life easy at the back-end when attempting to update the database. In an enterprise-level application, configurability is an important feature. This normally means that the application separates tables into two categories - static data (configuration parameters, business rules, etc), and business data (the real client records, transaction records, etc). The static data used within a form is not normally changed within the form, but rather is maintained in separate screens that are accessible only to system administrators or business analysts. Therefore, because this data is not changed it does not need to be re-sent to the server when saving the form.
Having both the static data, and the business data, and even some utilities fields (counters, etc) all in the one
- Static Data Instance - retrieved from the database by a JSP
- Business Data Instance - retrieved from the database by a JSP, and submitted to the database by a second JSP
- Template Instance - retrieved from the application server by a JSP, contains templates to be used when inserting new entities into the Business Data Instance (e.g. template containing empty fields for a new Client record)
- Administration/Utility Instance - static instance within the main XHTML/JSP form, containing working data items (next counters, etc)
<xf:instance id="data" src="GetClientData.jsp?clnt-id=< out.print(request.getParameter("clnt-id")); %>" />
<xf:instance id="data-templates" src="GetClientDataTemplates.jsp" />
<xf:instance id="static-data" src="GetClientMaintenanceStaticData.jsp" />
<xf:instance id="util" xmlns=""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<temp-cont-type>GEN</temp-cont-type>
<temp-cont-type-id />
<last-insert>-1</last-insert>
</xf:instance>
The key advantage of this approach is that the logic can be simplified at the back-end, both for the retrieves and for the updates. In particular, the submission now only sends the "data" instance to the server. The static data, the templates, and the admin information are retrieved but never resent back to the server.
No comments:
Post a Comment