• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Two different servlets to write to two frames in a frameset

 
Sue Stephen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a frameset that has two frames. Each frame should receive dynamic data from the server side. So I use Servlet0 to print the frameset to the client, Servlet1 and Servlet2 to print data to Frame1 and Frame2 within the frameset separately:
-------------------
In Servlet0:
.............
buffer.append("<frameset cols=\"400,*\" frameborder=\"YES\" border=\"0\" framespacing=\"0\">");
buffer.append("<frame src=\"Servlet1\" name=\"Frame1\" scrolling=\"YES\" noresize>");
buffer.append("<frame src=\"Servlet2\" name=\"Frame2\">");
buffer.append("</frameset>");
writer.println(buffer.toString());
......

In Servlet1:
I print some links which can retrieve data from the server through calling Servlet0 again
..........
buffer.append("<a href = \"Servlet0\">link1</a>");
writer.println(buffer.toString());
..........

In Servlet2:
I need to print some data depending on link1, which means it can be different each time user activates a different link.
..........
buffer.append("some data");
writer.println(buffer.toString());
..........

The problem I encounter now is:
When I call Servlet0, Frame1 can show correct information each time, but Frame2 only shows correct information for the very first time and does not change to show correct information even the user click a different link in Frame1. However, Servlet2 (which writes to Frame2) collects correct information each time.

Could anyone give some suggestion? I use Tomcat 4 to test my application. Thank you for your help.

Sue
 
Natarajan Shankar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sue,
I hope you have tried by clearing the buffer before writing. If servlet-2 able to receive retrieve proper info then it should be able to write in HTML. Hope buffering might be also an issue.
 
Sue Stephen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Natarajan,
Could you give some suggestions as how to clear the buffer? I have tried:
to change Servlet2 to:
.......
buffer.append("some data");
writer.println(buffer.toString());
response.flushBuffer();
writer.close();
........

Thank you.

Sue
 
Sue Stephen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have solved the problem. I should have added a "target=_top" to each link.

Sue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic