zoukankan      html  css  js  c++  java
  • application练习 留言薄

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <form action="messagePane2.jsp" method="post" name="form">
    输入名字:<input  type="text" name="name"><br>
    
    输入内容:<textarea name="messages" ></textarea><br>
    <input type="submit" value="提交信息" name="submit">
    </form>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    
    String name=new String (request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8");
    
    String messages=new String(request.getParameter("messages").getBytes("ISO-8859-1"),"UTF-8");
    String s="姓名:"+name+"<br>"+"内容:"+messages+"<br>"; 
    String str=(String)application.getAttribute("message");
    if(str==null)
    {
         application.setAttribute("message",s); 
    }
    else
    {  
         str+=s;
         application.setAttribute("message",str); 
    }
    out.print("您的信息已经提交!");
    %>
    <a href="news.jsp">查看留言</a>
    </body>
    </html>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <% 
    // application.removeAttribute("message");
     String s=(String)application.getAttribute("message");
     out.print(s);
    %>
    <a href="lianxi.jsp">继续留言</a>
    </body>
    </html>

  • 相关阅读:
    Python class:定义类
    Python return函数返回值详解
    Python None(空值)及用法
    Python函数值传递和引用传递(包括形式参数和实际参数的区别)
    Python函数的定义
    Python函数(函数定义、函数调用)用法详解
    Python reversed函数及用法
    Python zip函数及用法
    Python break用法详解
    Python嵌套循环实现冒泡排序
  • 原文地址:https://www.cnblogs.com/wallan/p/5631827.html
Copyright © 2011-2022 走看看