aspose file tools*
The moose likes Servlets and the fly likes some problems about servlets in frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "some problems about servlets in frame" Watch "some problems about servlets in frame" New topic
Author

some problems about servlets in frame

Huaying Feng
Greenhorn

Joined: Jan 22, 2002
Posts: 8
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: some problems about servlets in frame