Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

some problems about servlets in frame

 
Huaying Feng
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an index.html as follow.
<html>
<frameset rows="80%,*"border=1>
<frameset cols="50%,*"border=1>
<frame src="/mychat/servlet1">
<frame src="/mychat/servlet2">
</frameset>
<frame src="test.htm">
</frameset>
</html>
In servlet1 or servlet2, I wrote:
package mychat;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Servlet1 extends HttpServlet
{
private static final String CONTENT_TYPE = "text/html; charset=GBK";
//Initialize global variables
public void init() throws ServletException
{
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doRequest(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doRequest(request,response);
}
protected void doRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>test1</title></head>");
out.println("<style type=\"text/css\">");
out.println("body{font-size:10pt}");
out.println("</style>");
out.println("<body bgcolor=\"OLDLACE\">");
response.flushBuffer();
choke();
}
protected synchronized void choke()
{
try
{
while(true)
wait();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
And in test.htm, I just wrote a word "hello".
When I run it on Tomcat3.3, it's no problem. But, when I run it on Tomcat4.0 or Weblogic, the test.htm can not be shown. It seems opening servlet2 all the time.
I built this project in JBuilder7. My project is here.
Could you tell me why? Thanks in advance!

[ January 08, 2003: Message edited by: Huaying Feng ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic