Lab Notes Fourteen: Content Syndication Project

Here are the steps you need to take.

  1. Get xerces.jar from /u/dgerman/public.

  2. Place it in your $TOMCAT_HOME/lib/ directory.

  3. Add this place to your CLASSPATH environment variable.

    setenv CLASSPATH $TOMCAT_HOME/lib/xerces.jar:$CLASSPATH
    This has to be done in your ~/.cshrc file.

    Here's how my CLASSPATH variable looks like now: echo $CLASSPATH
  4. While you're at it add these two handy shortcuts as well:

    setenv startTomcat $TOMCAT_HOME/bin/
    setenv stopTomcat  $TOMCAT_HOME/bin/
    This has to be done in your ~/.cshrc file.

    Now you can use $stopTomcat and $startTomcat from the command line.

    (Do it when you recompile and have to reload a servlet.)

  5. Create a folder /u/username/foobar for your FooBar Bookstore Co. filesystem.

  6. Add a folder /u/username/foobar/data for the FooBar 'database'.

  7. Add interface.html into your apache_1.3.20/htdocs.

  8. Add into your apache_1.3.20/cgi-bin/foobar folder.

  9. Add a few books, check that /u/username/foobar/data/dataFile.txt gets created.

  10. Add into your apache_1.3.20/cgi-bin/foobar folder.

    Here's the code, that I forgot to post yesterday.

    use CGI; 
    $query = new CGI; 
    print $query->header, 
          "This is the Foobar Library Catalog. <p> "; 
    open (AB, "/u/dgerman/foobar/data/dataFile.txt"); 
    @x = <AB>;
    %library = (); 
    foreach $line (@x) {
        @line = split(/:/, $line); 
        $isbn = $line[4]; 
        $title       = $line[0]; 
        $author      = $line[1]; 
        $subject     = $line[2]; 
        $publisher   = $line[3]; 
        $isbn        = $line[4]; 
        $price       = $line[5]; 
        $numPages    = $line[6]; 
        $description = $line[7]; 
        print qq{ <hr>
            <dt>Title</dt> <dd> $title<p></dd> 
            <dt>Author</dt> <dd> $author<p></dd> 
            <dt>Subject</dt> <dd> $subject<p></dd> 
            <dt>Publisher</dt> <dd> $publisher<p></dd> 
            <dt>ISBN</dt> <dd> $isbn<p></dd> 
            <dt>Price</dt> <dd> $price<p></dd> 
            <dt>Number of Pages</dt> <dd> $numPages<p></dd> 
            <dt>Description</dt> <dd> $description <p></dd> 
    print "<hr> This is the catalog, thank you. ", $query->end_html;
  11. Add to the cgi-bin/foobar folder.

  12. At this stage I recommend you practice with XML a bit, but that's not a requirement.

    If you do want to practice I suggest you run FirstParser and then IndentingParser on the customer.xml file. Change it, update it, see what the programs report. Look into the programs as well. Use the documentation posted here and here as well.

  13. So the next required step is this: place in $myServlets.

  14. Place in $myServlets.

  15. Compile them.

  16. Access and view source.

And that's it for this lab.

Last updated on November 28, 2001, by Adrian German for A348/A548