Java
  Home arrow Java arrow Page 2 - The JSP Files (part 5): No Forwarding ...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

The JSP Files (part 5): No Forwarding Address
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2001-03-19

    Table of Contents:
  • The JSP Files (part 5): No Forwarding Address
  • Dumped!
  • The Scenic Route
  • One Step At A Time
  • New Friends
  • No Forwarding Address
  • Cleaning Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    The JSP Files (part 5): No Forwarding Address - Dumped!


    (Page 2 of 7 )

    If you're familiar with SQL, you know that there are four basic types of operations possible with a database:

    SELECT a record;

    INSERT a record;

    UPDATE a record;

    DELETE a record.

    In order to demonstrate these operations, we're going to build a little application that requires each of the functions listed above - an address book which allows multiple users to store and view contact information online.

    As always, one of the first things you have to think about when designing a data-driven application is the design of the database (duh!). For this application, we've decided to use a single table called "abook", which contains fields for different types of contact information - address, phone, fax, email address, and the like. Every user in the system has a unique login id, and each record in the database is "owned" by a specific user.

    We've put together a "dump file", which lets you create the database tables and initial set of records quickly - we suggest that you import this data into your mySQL database server, as we'll be using it throughout this article.

    To import the data, download the dump file and use this command at your mySQL prompt:

    $ mysql -u username -p database < dumpfile
    Or you could insert the contents manually - here is what you 'll need:

    # # Table structure for table 'abook' # DROP TABLE IF EXISTS abook; CREATE TABLE abook ( id int(11) unsigned NOT NULL auto_increment, uid varchar(255) NOT NULL, fname varchar(255) NOT NULL, lname varchar(255) NOT NULL, tel varchar(255), fax varchar(255), email varchar(255), addr text, company varchar(255), comment text, PRIMARY KEY (id) ); # # Dumping data for table 'abook' # INSERT INTO abook (id, uid, fname, lname, tel, fax, email, addr, company, comment) VALUES ( '1', 'john', 'Bugs', 'Bunny', '7376222', '', 'bugs@somedomain.com', 'The Rabbit Hole, Dark Woods, Somewhere On Planet Earth', '', 'Big-ears in da house!'); INSERT INTO abook (id, uid, fname, lname, tel, fax, email, addr, company, comment) VALUES ( '2', 'john', 'Elmer', 'Fudd', '', '7628739', 'fuddman@somedomain.com', '', '', ''); INSERT INTO abook (id, uid, fname, lname, tel, fax, email, addr, company, comment) VALUES ( '3', 'joe', 'Peter', 'Parker', '162627 x34', '', 'webcrawler@somedomain.com', 'Your Friendly Neighbourhood Newspaper', '', 'My spidey-sense is tingling!'); INSERT INTO abook (id, uid, fname, lname, tel, fax, email, addr, company, comment) VALUES ( '4', 'bill', 'Clark', 'Kent', '1-800-SUPERMAN', '', 'superdude@somedomain.com', '', '', 'Is it a bird? Is it a plane?');
    This will create a table named "abook" with columns for different types of contact information; these records are owned by three mythical users, "bill", "john" and "joe".

    Now check whether or not the data has been successfully imported with a SELECT query (the SELECT SQL statement is used to retrieve information from a database). Enter this at your mySQL command prompt:

    mysql> select uid, fname, lname from abook;
    which, in English, means "display the columns uid, fname and lname from the address book". Here's what you should see:

    +------+-------+--------+ | uid | fname | lname | +------+-------+--------+ | john | Bugs | Bunny | | john | Elmer | Fudd | | joe | Peter | Parker | | bill | Clark | Kent | +------+-------+--------+ 4 rows in set (0.00 sec)

    More Java Articles
    More By Vikram Vaswani and Harish Kamath, (c) Melonfire


     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup

    BlackBerry VTS




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway