jsp留言板
Posted jakermk
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jsp留言板相关的知识,希望对你有一定的参考价值。
1、留言板代码
<%@ 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="lianxi2.jsp" method="post"> <table width="500" height="400" border="1" cellpadding="0" cellspacing="0"style=""font:9pt;" bordercolordark="#666666" bordercolorlight="#FFFFFF" bordercolor="#FFFFFF"> <tr height="40" align="center"><td>留言簿</td></tr> <tr ><td> <textarea name="name" rows="25" cols="80"></textarea> </td></tr> <tr> <td align="center" coslspan="2"> <input type="submit" value="提交留言"> </td> </tr> </table> </form> </body> </html>
运行及输入留言:
2、留言转码并输出代码
<%@ 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> <table width="500" height="400" border="1" cellpadding="0" cellspacing="0"style=""font:9pt;" bordercolordark="#666666" bordercolorlight="#FFFFFF" bordercolor="#FFFFFF"> <tr height="40" align="center"><td>感谢您的留言</td></tr> <tr align="center"><td> <% String name=new String(request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8"); out.print(name); %> </td></tr> </table> </body> </html>
运行结果:
以上是关于jsp留言板的主要内容,如果未能解决你的问题,请参考以下文章