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("<html>");
printWrite.println("<head>");
printWrite.println("<title>新建Lotus记录</title>");
printWrite.println("</head>");
printWrite.println("<body>");
printWrite.println("<a href=/"#/">新建Lotus记录</a>");
String strSubject=outStr((String)Request.getParameter("Subject"));
String strAuthor=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.createSession();
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 (NotesException 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=strValue;
byte[] byteBuffer=strBuffer.getBytes("ISO8859-1");
String strReturn=new String(byteBuffer,"gb2312");
return strReturn;
}
catch(Exception e)
{
return null;
}
}
}
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("<html>");
printWrite.println("<head>");
printWrite.println("<title>新建Lotus记录</title>");
printWrite.println("</head>");
printWrite.println("<body>");
printWrite.println("<a href=/"#/">新建Lotus记录</a>");
String strSubject=outStr((String)Request.getParameter("Subject"));
String strAuthor=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.createSession();
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 (NotesException 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=strValue;
byte[] byteBuffer=strBuffer.getBytes("ISO8859-1");
String strReturn=new String(byteBuffer,"gb2312");
return strReturn;
}
catch(Exception e)
{
return null;
}
}
}