<H1>Finger Gateway</H1>
<FORM SUBMIT=finger.jsp METHOD=GET>
User name (me@somehost.com): <INPUT NAME=user>
<INPUT TYPE=SUBMIT>
</FORM>
<% 
if (request.getParameter("user")!=null) {
  Finger fing = new Finger();
  String inp = request.getParameter("user");
  String u;
  String host;
  int at = inp.indexOf('@');
  if (at==-1) {
     u="";
     host=inp;
     }
   else {
     host=inp.substring(at+1);
     u=inp.substring(0,at);
     }
  String s;
  try {
      s = fing.finger(host,u);
     }
  catch (Exception sexc) {
    s="Unknown host or network error";
    }

  int n0=0;
  do {
    int n=s.indexOf('\n',n0);
    if (n==-1) { 
      out.print(s);
      break;
      }
    out.print(s.substring(n0,n) + "<BR>");
    n0=n+1;
    } while (n0!=s.length());
}
%>
