BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>Color Testing</TITLE> </HEAD> <% String bgColor = request.getParameter(“bgColor”); boolean …
Category: Java/J2EE/J2ME
Aug 10
Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets
Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets First Last Email Address Marty Hall hall@corewebprogramming.com Larry Brown brown@corewebprogramming.com Bill Gates gates@sun.com Larry Ellison ellison@microsoft.com <%@ page contentType=”application/vnd.ms-excel” %> <%– There are tabs, not spaces, between columns. –%>
Aug 09
Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet.
Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of JSP Expressions. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>JSP Expressions</TITLE> <META NAME=”keywords” …
Aug 09
ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class
ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class (Check Servlet Section) <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of the import attribute of the page directive. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used …
Aug 08
QueryViewer.java: An interactive database query viewer
# QueryViewer.java An interactive database query viewer. Connects to the specified Oracle or Sybase database, executes a query, and presents the results in a JTable. Uses the following file: * DBResultsTableModel.java Simple class that tells a JTable how to extract relevant data from a DBResults object (which is used to store the results from …
Aug 07
AccessCounts.jsp Page that demonstrates JSP declarations.
AccessCounts.jsp Page that demonstrates JSP declarations. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>JSP Declarations</TITLE> <META NAME=”keywords” CONTENT=”JSP,declarations,JavaServer,Pages,servlets”> <META NAME=”description” CONTENT=”A quick example of JSP declarations.”> …
Aug 07
PreparedStatements.java An example to test the timing differences resulting from repeated raw queries vs. repeated calls
package cwp; import java.sql.*; /** An example to test the timing differences resulting * from repeated raw queries vs. repeated calls to * prepared statements. These results will vary dramatically * among database servers and drivers. With my setup * and drivers, Oracle prepared statements took only half * the time that raw queries required …
Aug 06
EmployeeCreation.java: Make a simple “employees” table using the database utilities
package cwp; import java.sql.*; /** Make a simple “employees” table using DatabaseUtilities. */ public class EmployeeCreation { public static Connection createEmployees(String driver, String url, String username, String password, boolean close) { String format = “(id int, firstname varchar(32), lastname varchar(32), ” + “language varchar(16), salary float)”; …
Aug 06
extract relevant data from a DBResults
# QueryViewer.java An interactive database query viewer. Connects to the specified Oracle or Sybase database, executes a query, and presents the results in a JTable. Uses the following file: * DBResultsTableModel.java Simple class that tells a JTable how to extract relevant data from a DBResults object (which is used to store the results from …
Aug 05
EmployeeTest2.java: A test case for the database utilities. Prints results formatted as an HTML table.
package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print “employees” table * as an HTML table. * */ public class EmployeeTest2 { public static void main(String[] args) { if (args.length < 5) { printUsage(); return; } String vendorName = args[4]; int vendor = DriverUtilities.getVendor(vendorName); …