(Description: Since the level is limited, the translation error is inevitable. In order not to cause the reader to cause the wrong concept, here is used in Chinese and English comparison)
A Simple Example A simple example
Description: This JSP view (service.jsp) enables the user (s) to administer the services the agency provides to its customers The user (an employee of the agency or call center agent) should get a list of all the existing services,. Along with update and delete data. Finally, An Empty Input Mask for Inserting New Services IS NEED. Description: This JSP view (Service.jsp) allows the user to manage the agent to provide customers. User (an representative of an agent or a call center) will get a list of all existing services, and update and delete data along with the text input box and buttons. Finally, an empty input interface is required to add new services.
Listing 1.js - service.jsp
<% - IMPORT DBFORMS TAG LIBRARY -%> <% @ Taglib Uri = "/ Web-inf / taglib.tld" prefix = "dB"%>
head> <% - show eventually ilcured errors -%>
<% - the header gets rendered one time -%>
services we provide h1>
Our EXISTING SERVICES h3> center>
ID tH>
name < / TH>
Description TH>
Actions th> tr> db: header>
<% - the body gets rendered for Each Data Row in The Query IT Contains Textfields and Action Buttons for Manipulating Data -%>
<; / td>
td>
td>
td> tr> < / db: body> <% - the footer gets rendred 1 Time IT Contains a Textfields for Entering New DataSets -%> table>
Enter New Service: h3> center>
id td>
td> tr >
name td> tr>
Description td>
td>
table>
center> dB: Footer>
db: dbform> body> html>
Remarks Remarks
WE HAVE SET MAXROWS TO "*" Which Has The Effect That All Rows Will Be Shown Atce. If Thee Exist Hundreds of Services, We Well Like To Set MaxRows To "10," 20, "OR Another Limited Number, And WE Would INSTANTIATE NAVIGATION Buttons for Scrolling Between The Pages. We have set the value of MaxRows to "*", which will display all rows once. If there are many services, we can set the value of MaxRows "10", "20", or other limited numbers. We can turn back and forth between the pages through the navigation buttons. This picture will be used later. The Errors Tag Shows A List of Errors, IF ANY Occurred (I. Duplicate Key Error, ETC.). If an error occurs (for example, a repetition error, etc.), the error tag will display the error list. The UpdateButton and DeleteButton Tags Arefore Placed In The Body and Therefore Rendered for Each ROW. The UpdateButton and DeleteButton tags in the body are displayed in each row. The result is shown in Figure 3: The result is shown in Figure 3
Figure 3.managing services (service.jsp)
An Example of Nested Forms An example of a nested form
The following page (customer_order.jsp) gives you the functionality to manage the incoming orders of a customer. You are able to edit both orders of a customer and the customer data itself. Furthermore, you do not need to struggle with plain service IDs, But Will Be Aable To Conveniently Select The Services from a select Box by name. The following page (Customer_Order.jsp) allows you to manage the received customer orders. You can edit customer orders or edit customer data. In addition, you don't have to worry about the monotonous service ID. Instead, you can easily select the service in the selection list.
Figure 4. Underlying Data for Customer_Order.jsp
Listing 2. Customer_Order.jsp
<% - import dbforms tag library -%> <% @ Taglib URI = "/ Web-inf / dbforms.tld" prefix = "dB"%>
head> <% - show eventually ilcured errors -%>
<% - the root form -%>
Customer h1> db: header>
<% - the body shows the data of the current customer -%>
ID TD>
td> tr>
< TD> First Name TD>
tr>
Last Name td>
address:
address: td>
td> tr>
postal code / city td>
- td> tr> table>
<% - Table Embedding The Subform -%>
Orders b> p> < / center>
<% - this is the begin of the subform: the subform renders all the services the current customer has ordered -%> <% - code for showing existing order ot design for trying existing Orders of Services for That Customer -%>
td>
Service TD>
ORDERDATE TD> Tr> db: header>
td>
<% - this allows the -%> name = "or_services" <% - select services conveniently -%> foreigntable = "service" <% - from a select-box -%> visiblefields = "name" storefield = STOREFIELD = "id" /> db: select> td>
td> tr> db: body>
td>
td> tr> table> <% - code for entering new orders of services -%>
Service TD>
DATE TD>
dB: select> td>
td>
td> tr> table>
<% - Navigating in The Subform (In The List of Orders of a Customer -%> < DB: navnextButton Caption = "Next>" /> center>
dB: Footer> dB: dbform> <% - subform end -%>
td> tr> table> <% - end of table embedding the subform -%>
<% - Editing Data Of -%> <% - customers -%> center> dB: body>
<%> <% - list of customers -%> center> db: footer> db: dbform> body> < / html>
Remarks Remarks
With this page, We Have Demonstrated Another Couple of Major Features of DBFORMS: On this page, we have already described another main feature of DBForms:
Nested Forms: The structure of this page is similar to the structure shown in Figure 2:. A main form has a sub-form inside its body The sub-form is linked to its parent by the equality of data fields defined in the child form's . parentField and childField attributes (If there is more than one field defining this mapping, a list of fields may be provided, with each field separated from the other by characters like "," or ";". or "~") nested Form: The structure of this page and the structure in Figure 2 are similar: one subform in a monotenia is a single body. The commonality of the parentfield and childfield properties of the child form associates the subformation and the parent form. (If you have multiple domains definition this mapping, there will be a list of domains, using "," or ";" or "~" each domain.) Navigation Buttons: Buttons: BECAUSE ONE CUSTOMER IS Visible At A . time, the user needs a way to navigate between records This functionality is provided by navFirstButton, navLastButton, navPrevButton, navNextButton elements navigation buttons: As the only one visible to customers, users need a way to move through the records. This feature provides this feature. Insert Button: The NavneWButton Element Navigates The User To An Empty Form To Enter New Data. Insert button: NavneWButton element Guide the user to enter a blank list to enter new data. select Tag: In addition to textField and textArea tags, more complex elements like select, radio, and checkbox can be used for data visualization and manipulation I have chosen a select tag to select the type of service a customer orders selected tags: addition TEXTFIELD and TEXTAREA labels, more complex elements such as selection lists, radio, and multi-selection are used to display and operate data. I chose a selection label to select the type of service of the customer order.
External data fetched by a tableData tag: This tag provides external data to radio, checkbox, or select tags It may be used for cross-references to other tables In our case, we initalized the select box with external data from the table ".. service. "Be aware that you have to distinguish between the field (s) to be shown to the user and those to be stored in the associated field in the table. in our case, we have shown the field service.name and stored the Value service.id in the associated field orders.service_id! The name order_services WAS Defined to enable Internal Caching of Data, Which Increases Performance. External data comes from a TableData label: This tag uses a radio, multi-selection and selection list to display external data . This can be used for cross-references with other tables. In our case, we initialize the selection list with the external data of the "service" table. Note that you must distinguish between the fields that are displayed to the user and those that are stored in the fields in the association table. In this case, we have seen the service.name field and save the value of Service.ID in the relevant field order .service_id! For internal data buffering to improve performance, we define the owr_services field name. Using associatedRadio elements to mark rows of data for certain actions (in our case we mark "orders" for the actions "update" and "delete") saves a lot of space and makes the interface clearer. If we had to draw a button for All Possible ActionS for Each Row Of Data, The Page Would Not Look Very Friendly. Using the AssociatedRadio element for some actions (in this case, we "Update" and "Delete" tag "Orders" not only save not only Many spaces, but also clear the interface. If we have to set a button for all possible actions of each line, then this page can be not so friendly. Figure 5. Managing Orders and Customers with One Single Page (Customer_Order.jsp)