top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How can I use a servlet to generate a site using frames?

0 votes
428 views
How can I use a servlet to generate a site using frames?
posted Nov 18, 2015 by Dominic

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In general, look at each frame as a unique document capable of sending its own requests and receiving its own responses. You can create a top servlet (say, FrameServlet) that upon invocation creates the frame layout you desire and sets the SRC parameters for the frame tags to be another servlet, a static page or any other legal value for SRC.

---------------------- SAMPLE ----------------------

          public void doGet(HttpServletRequest request,
          HttpServletResponse response) throws ServletException, IOException {
          response.setContentType("text/html");
          PrintWriter out = new PrintWriter (response.getWriter());

          out.println("");
          out.println("Your Title");

          // definingthe three rows of Frames for the main page
          // top : frm_1
          // middle : frm_2
          // bottom : frm_3

          out.println("");
          out.println("");
          out.println("");
          out.println("");
          out.println("");

          out.println("");
          out.println("");
          out.close();
          -------------------------- END ------------------------------------------

Where MenuServlet and DummyServlet provide content and behavior for the frames generated by FrameServlet.

answer Nov 19, 2015 by Karthick.c
...