Hi all,
I am using
Tomcat 3.0 as webserver with jdk1.3,
Servlet 2.0,
Templates for html file and oracle 8i on UNIX platform.
I have problem with multiple servlet running same webapplication.
There are two servlet used in my application. 1) GenServlet.class
and 2) ServletForPrinting.class
All of my pages go through GenServlet.class which reads some property files
and add header and footer in all pages.
I want reports without header & footer that is not possible through GenServlet in my application.
So I have used another servlet called ServletForPrinting --- just for reading html file.
It is as follow:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletForPrinting extends HttpServlet {
public void service (HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
// set content-type header before accessing the Writer
response.setContentType("text/html");
PrintWriter out = response.getWriter();
File f1 = null;
String report = null;
String path = request.getPathInfo();
try{
String p = "/var/home/latif/proj/webapps/WEB-INF/classes" + path;
System.out.println(p);
f1 = new File(p);
p = null;
if (f1.exists()) {
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
report = new String();
while ((report = br.readLine()) != null) {
out.println(report);
}
}
}catch(Exception e) {
}
out.close();
report = null;
path = null;
f1 = null;
}
} // end class
It works fine and display report properly.
But now Problem is that if report is refreshed many times subsequently,
WebServer will not take any new change in any of
java file used in web-application.
It works with the previous class only and not with updated one.
Then I need to touch it. As soon as I touch it, webserver will take updated class file.
Anybody has any idea regarding these situation?
Is there any bug in my ServletForPrinting.java ?
Any solution ??? Please suggest me.
Suggestion from all are invited. That will help me a lot.
Regards,
Deepalee.