<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%
  FileReader r;
  String s;
  String errm = ""; // error message?
// find file name
  String doc= request.getParameter("doc");  
// if no doc use index.txt
  if (doc==null) doc="index.txt";
  try {
      r = new FileReader(application.getRealPath(doc));
    }
  catch (IOException e) {
// whoops set error message and open error.txt instead.
    errm = e.getMessage();
    r = new FileReader(application.getRealPath("error.txt"));
    }
  BufferedReader br=new BufferedReader(r);
  s=br.readLine();  // get title
%>
<html>
<head>
<title><%= s %></title>
</head>
<body bgcolor=#FFFFF0>
<H1><%= s %></H1>
<%
 if (errm!="") {
   out.println(errm); 
   out.println("<BR>");
   }
 boolean ul=false;
 do {
   s=br.readLine();
   if (s!=null && s.length()!=0) {
     if (s.charAt(0)=='*') {
       if (!ul) out.println("<UL>");
       ul=true;
       out.println("<LI>");
       s=s.substring(1);
       }
     else if (ul==true) {
       ul=false;
       out.println("</UL>");
       }
     }
   if (s!=null) out.println(s);
   } while (s!=null);
 r.close();
// produce footer
%>
<hr>
<%= new Date().toString() %><BR>

</body>
</html>
