This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

some problems about servlets in frame  RSS feed

 
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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!