?? appliquer.java
字號:
/*
* test.java
*
* Created on 27 mai 2008, 20:55
*/
package ensao.TP1;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author Abdoulah
* @version
*/
public class Appliquer extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet test</title>");
//rouge,noir,jaune,vert,blanc,bleu
String[] couleur={"990000","000000","C9D000","51930A","FFFFFF","00B4FF",};
String f="", p="", l="",t="";
Cookie[] cookies = request.getCookies();
for(int i=0; i<cookies.length; i++) {
Cookie cookie = cookies[i];
String nomCookie = cookie.getName();
if (nomCookie.equals("fond"))
{
if(cookie.getValue().equals("rouge")) f=couleur[0];
if(cookie.getValue().equals("Noir")) f=couleur[1];
if(cookie.getValue().equals("Jaune")) f=couleur[2];
if(cookie.getValue().equals("Vert")) f=couleur[3];
if(cookie.getValue().equals("Blanc")) f=couleur[4];
if(cookie.getValue().equals("Bleu")) f=couleur[5];
}
if (nomCookie.equals("police"))
{
if(cookie.getValue().equals("rouge")) p=couleur[0];
if(cookie.getValue().equals("Noir")) p=couleur[1];
if(cookie.getValue().equals("Jaune")) p=couleur[2];
if(cookie.getValue().equals("Vert")) p=couleur[3];
if(cookie.getValue().equals("Blanc")) p=couleur[4];
if(cookie.getValue().equals("Bleu")) p=couleur[5];
}
if (nomCookie.equals("livre")) l=cookie.getValue();
if (nomCookie.equals("taille")) t=cookie.getValue();
}
out.println("<style>");
out.println(" body{ font-size:"+t+"px; }");
out.println("</style");
out.println("</head>");
out.println("<body bgcolor= '#"+f+"' text='#"+p+"'>");
out.println("<h1>votre type de livre pr閒er
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -