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>

  • 相关阅读:
    为什么整个互联网行业都缺前端工程师?
    css3做的圆特效
    又一个前端的小渣渣诞生了
    返回顶部代码!
    网页动画的十二原则
    JQuery缓冲加载图片插件lazyload.js的使用方法
    关于写手机页面demo的准备工作
    HTML5加载动画
    HTML5加载动画
    正则表达式语法
  • 原文地址:https://www.cnblogs.com/wallan/p/5631827.html
Copyright © 2011-2022 走看看