Project 2

Web based Bible Retrieval


The goal of this project is the development of a web based program for retrieving Bible verses from a sequential file containing the Bible text. The program will use a Web based user interface. The user will supply the book, chapter, verse, and number of verses to the program, and the program will display the verse(s). This project builds on the last, reusing the Bible, Verse, and Ref classes in a Web enviornment.


This project has the following learning goals:

  1. Sequential file search and retrieval
  2. Development of a robust, friendly, Web Based user interface using AJAX.
  3. Modularization of program by logical function.

Initial Setup

  1. Create a folder in your web directory to hold your CGI executable program.
    $ cd /var/www/classes/csc3004/yourusername/
    $ mkdir cgi-bin
  2. Create a project folder and copy the demo code there:
    Return to your main directory
    $ cd ~
    $ mkdir proj2
    $ cd proj2
    $ cp /home/class/csc3004/bibleajaxdemo/* .
  3. Edit bibleajax.html and Makefile to use YOUR username, rather than "skon"
  4. Build and Deploy
    $ make
  5. Try it. Go to:


This section will give ideas and hints about how to approach the various aspects of the problem.

Conceptual design

This project will use the objects designed and tested in the previous projects. These objects will be interfaced to a web CGI/AJAX interface. There are two major components of the system:

  1. A HTML/JavaScript page that creates the user interface for the user. The usre enters the requested information, and the page displays the results.
  2. A C++ program, called a CGI (Common Gateway Interface) program, that runs when the "Submit" button is pressed on the web page. The fields in the web page are passed to this program, which looks up the requested verses in the Bible (using the Bible objects), and return the result to the web page for display.

Development Strategy

Try to "build" you solution from the bottom up - writing and testing low level routines independently, then assembling them into a larger program when they work.

For example - you already create a program which, given a verse reference, will parse it and return the numeric value of the chapter and verse number. I have given you some same CGI/AJAX code. Now you can integrate the Bible classes into the code I gave you.

User Interface

A major goal of this assignment (as well as future ones) is to create a friendly and robust user interface. By friendly I mean the program should be easy to use, even for a computer novice, without instruction. In addition, the output, option selection, etc., should be clean and symmetrical (more of this in class). By robust I mean that the program should be immune to all garbage input - e.g. the program should capture and report ALL user errors, rather then crashing.

Sample Code

A web page will be used for the user interface. The code necessary to do this is located in “"/home/class/csc3004/bibleajax/”. Copy everything in this directory to a NEW directory of your own (DO NOT copy this into the same directory as the sample_reader, each “makefile” must have its own directory). You must edit “Makefile”, and change the line that says: USER = skon to have your login ID instead. You must also edit bibleajax.html to change all instances of “skon” to your username.

Do a “make”. This will build the code, and push the results out to the web directories. You may then access the resulting web page at:

You will need to work with two files:

1. bibleajax.cpp - This file contains the actual c++ code for communicating with the web page server (and thus with your web page). The web page is a form the user fills in, and when the user hits the “submit” button, the page uses the AJAX module to send the form values to the C++ program. The C++ program then returns the result using AJAX calls. This file will replace the "biblereader.cpp" file from the previous project. You will still use the Bible, Ref, and Verse files.

You will modify this code to call your Bible object routines as needed. NOTE - I expect you to keep the file routines in a separate C++ file to improve modularity! After this file has been remade, you can write it to the appropriate directory for the Web Server to use with the “make PutCGI ” command. (This is a shell script included in the directory)

2. bibleajax.html - This is a starter web page interface. You will need to modify it for your purposes, and comment out features, which you will not be using on the first project. After this file has been remade, you can write it to the appropriate directory for the Web Server to use with the “make PutHTML ” command.

3. Makefile - This make builds and pushes the code out tothe server. Importantly, it places the CGI executable into /yourname/cgi-bin. You will need to create the "cgi-bin" directory before you do a make, or the make will fail to copy the CGI code. You will need to add to the Makefile so that it builds the Bible, Verse, and Ref files in addition to what it currently does.

Project Milestones

Following is a list of project milestones, with incentives provided for each milestone met before the date due. Note that each pre-final due date milestone is worth 5 extra points. The project itself is worth 100 points, with up to 10 extra points for providing extra options. Thus it is possible to receive up to 120 out of 100 points on the project!

To receive points on the milestones you must simply demonstrate that the milestone has been achieved prior to the given date. I will not be particular about the performance or robustness of the program during these examinations - I really just want to see reasonable progress.

Milestone Completion date PointsSorted ascending
1. Basic User interface - able to interact with user nicely Feb. 8 5
2. Basic overall system functionality some of the time
(system may not do everything right, but its getting close!)
Feb. 11 5
Extra credit for additional options as specified below Feb 18 10
3. Complete system as specified. User interface and file routines
MUST be broken into separately compiled modules
Feb 18 100


Percent Grade Comments Description
40%     How well the program works with respect to the given specifications. (NO credit will be given for a program that doesn't run.)
15%     User friendliness. Should meet the criteria covered in class.
25%     Internal program structure. The program should be well organized into procedures. Remember "maximize cohesion, minimize coupling".
20%     Comments - The code must be clearly commented. I must be able to understand just how this system has been implemented. Follow the internal documentation standards discussed in class. Also, each minor section of each procedure should also be preceded by a short explanation.
10% Extra Credit.     Use another bible version and allow user to select version. (many others exist). Could allow display in parallel (split screen?) You may implement part of these enhancements for partial extra credit.
How to turn your project in

  • Turn in (On Moodle): A cover sheet file with your name, project title (“Project 2, Web Bible”), and the Milestone number (1, 2, or 3). A file describing any added features to be considered for Extra Credit. A file of each page from a web browser A file of each source file and HTML file.
  • For the final milestone submit the following to Moodle: (1) A link to the starting point of your project (2) Any instructions for use.
Topic revision: r8 - 2016-02-18 - JimSkon
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback