当前位置: 代码迷 >> JavaScript >> textarea 文本区域 jsp兑现
  详细解决方案

textarea 文本区域 jsp兑现

热度:157   发布时间:2012-10-24 14:15:58.0
textarea 文本区域 jsp实现
<!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>
<style  type="html/css">
<!--
.STYLE{
    font-size:large;
}

-->

</style>
</head>
<body>
<form name="form1" action="textarea.jsp" method="post">
<span class="STYLE1">文本区域<br/></span>
<textarea name="textarea" cols="60" rows="15">请在这里输入文字......</textarea>
<hr  />
<!--name 属性在request对象中取值时使用  -->
<input name="ok" type="submit" value="提交">
</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>
<h3>您输入的是:</h3>
<h2>
<%
//设置request对象的字符编码集,避免中文显示的乱码
request.setCharacterEncoding("UTF-8");
String input=request.getParameter("textarea");
out.print("<span>");
out.print(input);
out.print("</span>");
%>
</h2>
</body>
</html>
  相关解决方案