Import javax.servlet. *;
Import javax.servlet.http. *;
Import Lotus.domino. *;
Import java.io.printwriter;
Import java.io.ioException;
Public class create_doc extends httpservlet
{
Public void doget (httpservletRequest request, httpservletResponse response)
Throws ServleTexception, IOException
{
Response.setContentType ("text / html; charSet = GB2312");
PrintWriter PrintWrite = response.getwriter ();
PrintWrite.println ("");
PrintWrite.println ("
");PrintWrite.Println ("
PrintWrite.println (" head>");
PrintWrite.println ("
PrintWrite.Println (" New Lotus Record ");
String strsubject = outstr (String) Request.getParameter ("Subject"));
String stradurthor = outstr (String) Request.getParameter ("author");
String strdatetime = outstr (String) Request.GetParameter ("DateTime"));
String strbody = outstr (String) Request.GetParameter ("body"));
Try
{
Notesthread.sinitthread ();
SESSION session = notesfactory.createsis ();
Database db = session.getdatabase ("DigitalTitan / HomePage.nsf");
IF (db! = null)
{
Document doc = db.createdocument ();
Doc.replaceItemValue ("form", "formservlet");
Doc.replaceItemValue ("Subject", strsubject);
Doc.replaceItemValue ("Author", StrauThor);
Doc.replaceItemValue ("DateTime", strdatetime);
Doc.replaceItemValue ("Body", Strbody;
Doc.save (TRUE);
Doc.recycle ();
Db.Recycle ();
}
Else
{
PrintWrite.println ("Error ...");
}
session.Recycle ();
}
Catch (NotSexception n)
{
PrintWrite.Println ("ID:" N.ID); PrintWrite.println ("text:" n.text);
}
Catch (Exception E)
{
E.PrintStackTrace ();
}
Finally
{
NoteSthread.stermthread ();
}
PrintWrite.println (" Body> HTML>");
}
Public String Outstr (String Strvalue)
{
Try
{
String strbuffer = strengther;
Byte [] bytebuffer = strbuffer.getbytes ("ISO8859-1");
String strreturn = new string (Bytebuffer, "GB2312");
Return Strreturn;
}
Catch (Exception E)
{
Return NULL;
}
}
}