JSPs @ palmdrive

How to install

Nothing is simpler than that. Just download the ZIP file and extract the file (fortune.jsp) in your webserver repository. You then just need to specify where the program should read all the fortune files. Open fortune.jsp in your favorite text aditor and modify the line (on top of the JSP file):
    public static final String CFG_FILE = "C:\\fortune\\fortune.cfg";
  
To hold the file in which you will specify all your fortune files. This text file (fortune.cfg) must be present and contain the list of fortune files you want the JSP to choose from. It will look like:
  C:\fortunes\art
  C:\fortunes\ascii-art
  C:\fortunes\computers
  C:\fortunes\cookie
  
If you want to use the four files art, ascii-art, computers, cookie that are in the directory C:\fortunes.

You can download fortune files from many places, including but not limited to:

The last step is to create a JSP in which you will call the guestBook API. The simple JSP is listed below:
     <HTML>
     <HEAD>
     <TITLE>fortune</TITLE>
     </HEAD>
     <BODY>
     <%@ include file="fortune.jsp" %>
     </BODY>
     </HTML>
  

Basic configuration

There is not much to configure. However, a couple of options can be used to help debug the product:
  • Know which message is being displayed
You can easily display which message is being displayed by changing the last line of the fortune.jsp file: Replace <%= getFortuneMessage(request,false) %> with <%= getFortuneMessage(request,true) %>. This will add a line on top of the fortune that looks like: 123/524. 123 is the number of the current fortune, 524 the total number of cookies to choose from.

  • Display a specific fortune
You can display the first fortune, or the last or any number by adding ?fortunemsg=n to your URL, where n is the number of the cookie you want displayed. So let's say you want to see the fortune number 43, and your JSP is called index.jsp, just type in http://mywebserver.com/index.jsp?fortunemsg=43.

Download

Download the Version 1.0 here.
Beware! This file is so big (3kb) that it could take up to 1.5 seconds with a 28.8 modem!