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>

  • 相关阅读:
    【异常】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '**' not found.的解决办法
    java如何进行字符串拼接?
    poj2352消防站
    NOIP第7场模拟赛题解
    转载:
    usaco 2010年3月银组题解
    Js 向json对象中添加新元素
    List<T>中 GetRange (int index, int count)的使用
    C# string格式的日期时间字符串转为DateTime类型
    C# DataTable转List<T>--利用反射
  • 原文地址:https://www.cnblogs.com/wallan/p/5631827.html
Copyright © 2011-2022 走看看