CNT 4714 - FALL 2008 - Code Examples
MULTI-THREADED APPLICATIONS
JAVA NETWORKING
Part 2:
Simple UDP Server (non-GUI) - page 10
Simple UDP Client (non-GUI) - page 12
Simple TCP Server (non-GUI) - page 19
Simple TCP Client (non-GUI) - page 21
GUI-based TCP Server - page 25
Driver class for GUI-based TCP Server - page 41>
GUI-based TCP Client - page 33
Driver class for GUI-based TCP Client - page 42
Part 3:
HTML file for SiteSelector Applet - high-level networking API example - page 20
SiteSelector Applet for above - page 21
ReadServerFile - high-level networking example - page 25
ReadServerFile Driver program - page 25
Note: Before the following will execute you will need to run keytool to set up a keystore and certificate for the SSL
Also, these two classes are in package: securitystuff/jsse.
SSL Server Class - page 41
SSL Client Class - page 44
A multi-threaded,networked client/server example
Multithreaded TicTacToe Server class
Test Class for TicTacToe Server
Client side for client/server TicTacToe
Test Class for TicTacToe Client
JDBC
SQL script for creating the bike database used in many of the MySQL and JDBC Examples
Simple JDBC Example - page 20
DisplayBikes Application - page 27
ResultSetTableModel class - page 33
DisplayQueryResults Application - page 40
Displaying database information using PreparedStatement - page 52
JDBC RowSet example - page 62
SERVLETS
Part 2:
NOTE: All of these files are assumed to be part of a web application named "first-examples".
Welcome Servlet HTML file
Welcome Servlet Java file
web.xml configuration file (NOTE: Current name is "first-web.xml", you must rename this file to "web.xml" once you place it inside the "first-examples" webapp.
Part 3:
NOTE: All of these files are assumed to be part of a web application named "CNT4714".
index.html - "home page" for servlets
web.xml configuration file - initial version you'll need to add to this later "
User Friendly Welcome Servlet (welcome2) - HTML file
User Friendly Welcome Servlet - Java file
Welcome Servlet Using a Post Method (welcome3) - HTML file
Welcome Servlet Using a Post Method - Java file
Current Date/Time Servlet - Java file
ReDirection Servlet - HTML file
ReDirection Servlet - Java file
Part 4:
RepeatVisitor: Cookie Demonstration Servlet - HTML file
RepeatVisitor Servlet - Java file
CookieTest: Session and Persistent Cookie Demonstration Servlet - HTML file
CookieTest Servlet - Java file
CookieUtilities class is used by ClientAccessCounts class below - Java file
ClientAccessCounts Servlet - Java file (this one is not accessible from the index page - execute it directly with http://localhost:8080/cop4610/cookieaccess)
ShowSession: Session Cookie Demonstration Servlet - HTML file
ShowSession Servlet - Java file
Part 5:
Servlet that returns an Excel spreadsheet - Java file
ImageContent: Servlet that returns both images and text - HTML file ***be sure to set the files properly for this to work!
ImageContent Servlet - Java file
Color Survey MySQL Script
Color Survey (3-tier application) - HTML file
Survey Servlet - Java file
JSP
Part 1:
clock2.jsp - page 8
welcome.jsp - page 17
Part 2:
ComputeLoan.html - page 6
ComputeLoan.jsp - page 7
ComputeLoan2.html - page 6
ComputeLoan2.jsp - page 7
Loan.java - page 10 (required for ComputeLoan2.jsp)
include.jsp - page 20
banner.html - page 22
toc.html - page 23
clock2.jsp - page 24
forward1.jsp - page 27
forward2.jsp - page 29
Part 3:
Be sure to set up the proper directory structure for the packages in these examples.
picturerotator.jsp - page 18
Rotator JavaBean File - page 17
SQL Script to create guestbook database
GuestBean.java JavaBean File - page 29
GuestDataBean.java JavaBean File - page 31
guestBookLogin.jsp - page 34
guestBookView.jsp - page 37
guestBookErrorPage.jsp - page 40
PHP
NOTE: All of these file should be loaded into your WAMP server www folder.
Images for use with the form.html application and others - rename to "images" and locate in www directory under WAMP
Basic php script with function call - page 10
Basic php script without function call - page 14
Displays PHP server variable values - page 19 - change it around to display other superglobal values
Client side form - page 22
Server side php script for handling the form - page 25
Expression.php for regular expression test - page 36
Client side secure entry screen - page x
Server side php script to handle password - page x
Client side data entry for database query - page x
Server side php script to handle database access - page x
Client side form to enter cookie values - page x
Server side php script to handle the cookie - page x
Server side php script to read cookie values - page x
SQL script to create mailinglist DB>
Client side database entry form - page x
Server side php script to access database - page x
Last updated: December 2, 2008
Return to CNT 4714 home page