The fortune JSP |
What is it ? |
Installation |
Basic Configuration |
License? What license? |
Download |
Some more help? |
The fortune JSP is a piece of code that let you integrate fortune cookies into your JSP pages. No big deal. The only nice thing is that:
|
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\cookieIf 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> |
There is not much to configure. However, a couple of options can be used to help debug the product:
<%= 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.
?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 .
|
Let's talk about some license here... First of all, there is no such things as a license attached to this piece of code. Let's face it: Too simple to be licensed, right ? But... of course, there's some stuff I would like you to do if you ever decide to use my code...
|
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! |
No FAQ, No Help page, nothing... Just send me a mail or
post your question in the guest book.
|