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>

  • 相关阅读:
    IntelliJ IDEA 14.03 java 中文文本处理中的编码格式设置
    应聘感悟
    STL string分析
    CUDA SDK VolumeRender 分析 (1)
    BSP
    CUDA SDK VolumeRender 分析 (3)
    CUDA SDK VolumeRender 分析 (2)
    Windows软件发布时遇到的一些问题
    Ten Commandments of Egoless Programming (转载)
    复习下光照知识
  • 原文地址:https://www.cnblogs.com/wallan/p/5631827.html
Copyright © 2011-2022 走看看