<%@ page language="java" contentType="text/html" import="myDB.*" %> Create a new Account <% AccountTableInteraction dti = new AccountTableInteraction(); String result = dti.insertTuple( dbBean, false ); // insertTuple of DeptTableInteraction will returns a non-empty // string only if something goes wrong. if ( result != null ) { if ( result.equals( "account" ) ) { //dbBean.setErrorMsg( // "New Contact was added. Account is active, can't update."); //dbBean.setCustNo(null); session.invalidate(); %> <% } else { //dbBean.setErrorMsg( result ); } session.invalidate(); } %> <% // retrieve all tupe from the table. This function will return a // message (not null) if something goes wrong as we retrieve tuple. result = dti.retrieveAllTuples(); if( result != null ) { dbBean.setErrorMsg( result ); %> <% } // Once we get to this point, we must have been able to insert the // tuple in the database and query the database without any problem. // Let's write out the // contents of the database table in which we inserted this tuple // and print it using an HTML table. %> <% while( dti.hasMoreTuples() ) { // notice the following jsp line allows us to execute a Java *expression* // (in this case, dti.getOneTupleInHTMLtableFormat) and write its result in the // html file that is being generated by this jsp file. Please notice the = after %. %> <%= dti.getOneTupleInHTMLtableFormt() %> <% } // all done! session.invalidate(); %>