一个简陋的留言板

【效果图】
一个简陋的留言板_第1张图片
一个简陋的留言板_第2张图片
一个简陋的留言板_第3张图片

就两个jsp文件搞定
example2_1.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*"%>


    
        
        留言板
        
    
    
        
Name:  
Content:


view comments

sub.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*"%>


    
        
        example3_1
    
    
        <%
            request.setCharacterEncoding("utf-8");
            if (application.getAttribute("mainboard")==null){
                application.setAttribute("mainboard", "");
            }
            String cur = (String)application.getAttribute("mainboard");
            if (!(request.getParameter("user")==null) &&
                    !(request.getParameter("newwords")==null)){
                String user = request.getParameter("user");
                String words = request.getParameter("newwords");

                if (cur.length()!=0){
                    cur = cur + "
"; } cur = cur + user+":"; cur = cur + words; application.setAttribute("mainboard", cur); } out.print(cur); %>

返回

你可能感兴趣的:(一个简陋的留言板)