hello:
i'm thinking of writing every count for every servlet visit to a counter
file. this file would record the datetime, name of servlet visited, and this
file will be read easily (txt format) by means from browser or whatsoever.
question is: how do i update the counter file efficiently? and also
considering concurrent access. i thought of one: that is to open & close the
file everytime the servlet is called. is this a good method, a preferred
one? or anyone can suggest a better solution to this?
say my servlet is as follows:
/* servlet one */
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
/* updating of counter file here
...........
..........
..........
*/
out.print("servlet one");
out.close();
}
/* servlet two */
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
/* updating of counter file here
...........
..........
..........
*/
out.print("servlet two");
out.close();
}
/* servlet three as per previous */
/* servlet four as per previous */
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html