///////////////////// //UpdateGroup.java // It either creates or deletes group id from // groupid.txt file // Sep. 9, 99 Myeongjin (Jen) Lee ///////////////////////// import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class UpdateGroup extends HttpServlet { String logfile = "/export/home/webuser/pulsar-patient/htdocs/Log/groupid.txt"; public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ PrintStream out; res.setContentType("text/html"); out = new PrintStream(res.getOutputStream()); String id = req.getParameter("id"); String password = req.getParameter("password"); String which = req.getParameter("which"); PrintHeader(out); // do the file thing try { RandomAccessFile raf = new RandomAccessFile(logfile,"rw"); raf.seek(raf.length()); raf.writeBytes(id+"\n"); raf.close(); } catch (IOException e) { out.println("Error opening file: " + e); } PrintBody(out); } private void PrintHeader(PrintStream out) { String h="\n"; out.println(h); } private void PrintBody(PrintStream out){ String h="file created\n"; h += "\n"; h += "\n"; out.println(h); } }