zoukankan      html  css  js  c++  java
  • 1123

     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     4 <html>
     5 <head>
     6 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     7 <title>Insert title here</title>
     8 </head>
     9 <body>
    10 
    11 <%
    12 
    13 request.setAttribute("mes", "页面出错!");
    14 
    15 %>
    16 
    17 <jsp:forward page="test.jsp"/>
    18 
    19 </body>
    20 </html>
    21 
    22 
    23 
    24 <%@ page language="java" contentType="text/html; charset=UTF-8"
    25     pageEncoding="UTF-8"%>
    26 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    27 <html>
    28 <head>
    29 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    30 <title>Insert title here</title>
    31 </head>
    32 <body>
    33 
    34 <%
    35 
    36 String mes=request.getAttribute("mes").toString();
    37 
    38 %>
    39 
    40 转发信息=<%=mes %>
    41 
    42 
    43 
    44 </body>
    45 </html>

     1 <%@ page language="java" contentType="text/html; charset=UTF-8"
     2     pageEncoding="UTF-8"%>
     3     <%@page import="java.net.URLEncoder" %>
     4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     5 <html>
     6 <head>
     7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     8 <title>Insert title here</title>
     9 </head>
    10 <body>
    11 娃娃
    12 <% //页面重定向,判断用户权限
    13 
    14 //response.sendRedirect("http://www.baidu.com"); 
    15 
    16 String strHq =URLEncoder.encode("汉企");
    17 
    18 Cookie co =new Cookie("cookie_key",strHq);
    19 
    20 co.setMaxAge(60*60*24*30*12);//单位秒
    21 
    22 response.addCookie(co);
    23 
    24 
    25 
    26 response.getWriter().write("向客户端发送信息");
    27 
    28 out.print("输出一段话");
    29 
    30 out.println("输出一段话后换行");
    31 
    32 out.print("再输出一段话");
    33 
    34 
    35 
    36 session.setAttribute("session_key", "hello");
    37 
    38 %>
    39 
    40 <%=strHq %>
    41 
    42 
    43 </body>
    44 </html>
    45 
    46 
    47 <%@ page language="java" contentType="text/html; charset=UTF-8"
    48     pageEncoding="UTF-8"%>
    49         <%@page import="java.net.URLDecoder" %>
    50     
    51 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    52 <html>
    53 <head>
    54 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    55 <title>Insert title here</title>
    56 
    57 <%  //定时跳转
    58 //response.setHeader("refresh","2;URL=http://www.baidu.com");
    59 
    60 Object obj=session.getAttribute("session_key");
    61 
    62 if(obj!=null)
    63 {
    64     out.print("session_key="+obj.toString());
    65 }
    66 else
    67 {
    68     response.sendRedirect("login.jsp");
    69 }
    70 %>
    71 
    72 </head>
    73 <body>
    74 
    75 <%
    76 
    77 Cookie[] c=request.getCookies();
    78 String strC="";
    79 
    80 if(c!=null)
    81 {
    82     for(int i=0;i<c.length;i++)
    83     {
    84         if(c[i].getName().equals("cookie_key"))
    85         {
    86         strC += c[i].getName() + "=" +URLDecoder.decode(c[i].getValue()) +";";
    87     }
    88         }
    89 
    90 }
    91 
    92 %>
    93 cookie值=<%=strC %>
    94 
    95 </body>
    96 </html>

  • 相关阅读:
    IL查看泛型
    IL查看委托
    IL查看override
    为VS集成IL环境
    HashTable Dictionary HashMap
    C#集合类
    Resharper团队协作之TODO
    怪物彈珠Monster Strike 攻略
    [Editor]Unity Editor类常用方法
    C# Reflection BindingFlags
  • 原文地址:https://www.cnblogs.com/ymf123/p/4989509.html
Copyright © 2011-2022 走看看