3
WebSheets UI Servlet Parameters SQL Statements ResultSet Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows a user to directly map input parameters to output table cells, as shown by the dotted arrow from the MinStock text of Page1 to the reference in the DelSelect row of the table in Page2.With servlet programming and approaches such as that of UltraDev 4, the mapping is not so direct, as shown by the series of darkened arrows.

WebSheets UI Servlet ParametersSQL StatementsResultSet Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WebSheets UI Servlet ParametersSQL StatementsResultSet Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows

WebSheets UI

Servlet Parameters SQL Statements ResultSet

Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows a user to directly map input parameters to output table cells, as shown by the dotted arrow from the MinStock text of Page1 to the reference in the DelSelect row of the table in Page2.With servlet programming and approaches such as that of UltraDev 4, the mapping is not so direct, as shown by the series of darkened arrows.

Page 2: WebSheets UI Servlet ParametersSQL StatementsResultSet Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows

WebSheets Internal Architecture

WebDev Code Generator

XMLCHTML template

Java DOM tree code

Servlet including JDBC and DOM manipulation code

Figure 3. Code generation in WebDev

WYSIWYG specs

Page 3: WebSheets UI Servlet ParametersSQL StatementsResultSet Figure 2. An input form page (Page1) and a result page (Page2) during development. WebDev allows

Sample Generated ServletIf(actionTag.equals(“remove”)) {// Access request parametersString minStock = req.getParameter(“MinStock”);// Access DOM tree created from HTML templBookListDOM doc = new BookListDOM(); // Execute specified delete operations using JDBC and// SQL Delete statementsstmt.execute("delete from BOOKS where INSTOCK<" + minStock);// Execute the specified Select statement to obtain a resultset.rs = stmt.executeQuery("select BOOKS.ISBN, BOOKS.NAME,BOOKS.PRICE, BOOKS.INSTOCK from BOOKS where INSTOCK>10 and PRICE>22");// Use DOM manipulation code to:while(rs.next()) {// Use DOM manipulation code to enter these values in the DOM tree.

doc.setText_table1_col0(rs.getString(1));doc.setText_table1_col1(rs.getString(2));doc.setText_table1_col2(rs.getString(3));doc.setText_table1_col3(rs.getString(4));

// Evaluate the spreadsheet formulas of the “expressions” doc.setText_table1_col4(

String.valueOf(rs.getInt(3) * rs.getInt(4)));// Clone the sample row

tempRow.getParentNode().insertBefore(tempRow.cloneNode(true), tempRow);}// Remove the sample rowtempRow.getParentNode().removeChild(tempRow);// Write the updated DOM tree to the browserout.println(doc.toDocument());} else if(actionTag.equals(“add”)) { // …}