FileDocCategorySizeDatePackage
WindowServlet.javaAPI DocExample1521Mon Jun 02 17:40:58 BST 2003com.jspservletcookbook

WindowServlet

public class WindowServlet extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

    
    //URL for the pop-up window is configured
     String url = getInitParameter("popup-url");
    
     if (url == null || url.equals(""))
         url = "/displayHeaders.jsp"; //just in case the initParameter is misconfigured
    
     //add the context path as a prefix to the url, as in /home
     url = request.getContextPath() + url;
     
      response.setContentType("text/html");
      java.io.PrintWriter out = response.getWriter();
      out.println("<html><head>");
      RequestDispatcher dispatcher = request.getRequestDispatcher(
          "/WEB-INF/javascript/functions.js");
      dispatcher.include(request, response);
      
      out.println("<title>Help Page</title></head><body>");
     out.println("<h2>Cookie Info</h2>");
      out.println("<form action =\"\" onSubmit=\" return false\">");
      out.println("<table border=\"0\"><tr><td valign=\"top\">");
      out.println(
      "Click on the button to get more info on cookies: </td>  <td valign=\"top\">" +
       "<input type=\"button\" name=\"button1\" value=\"More Info\" onClick=\"CreateWindow('" +
	    url + "')\"></td></tr>");
      out.println("</table></form>");
     
      out.println("</body></html>");
      out.close();