⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 specialdiet2.java

📁 java2 primer plus一书源程序
💻 JAVA
字号:
/*
 * SpecialDiet2.java
 *
 * Created on June 25, 2002, 1:27 PM
 */

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;

/**
 *
 * @author  Stephen Potts
 * @version
 */
public class SpecialDiet2 extends HttpServlet
{
   
   /** Initializes the servlet.
    */
   public void init(ServletConfig config) throws ServletException
   {
      super.init(config);
      
   }
   
   /** Destroys the servlet.
    */
   public void destroy()
   {
      
   }
   
   
   /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    */
   protected void doGet(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, java.io.IOException
   {
      response.setContentType("text/html");
      PrintWriter out = response.getWriter();
      
      Cookie cookies[];
      cookies = request.getCookies();
      
      System.out.println("Creating the SpecialDiet HTML");
      
      // output your page here
      out.println("<html>");
      out.println("<head>");
      out.println("<title>" + "Your Diet Choices" +
      "</title>");
      out.println("</head>");
      out.println("<body BGCOLOR=\"#FDF5E6\"\n>");
      out.println("<h1 ALIGN=CENTER>");
      out.println("Here are your choices");
      out.println("</h1>");
      for (int i=0; i< cookies.length; i++)
      {
         System.out.println(cookies[i].getName()+ "  " + cookies[i].getValue() + "<BR>");
         out.println(cookies[i].getName()+ "  " + cookies[i].getValue() + "<BR>");
         out.println(" ");
      }
      out.println("</body>");
      out.println("</html>");
      
      out.close();

   }
   
   /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    */
   protected void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, java.io.IOException
   {

   }
   
   
   /** Returns a short description of the servlet.
    */
   public String getServletInfo()
   {
      return "Short description";
   }
   
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -