• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Problem with running multiple servlet in same webappication with tomcat 3.3.1

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to move this to the Tomcat forum.

Basically, what you are looking for is "hot" deploying. Meaning as soon as you update the file on the machine the web server should automatically load the new changes.

Tomcat does do this, but it has to see that the actual file has changed. Hence, when you touch it, your are changing the file.

Mark
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic