日期:2014-05-18 浏览次数:20716 次
myexampleResponse1.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head></head>
<body>
<p>输入名字:</p>
<form action="myexampleResponse1R.jsp" method="post" name="Response1R_FORM">
<input type="text" name="username" />
<input type="submit" name="boy" value="登陆"/>
</form>
</body>
</html>
myexampleResponse1R.jsp:
<html>
<head></head>
<body>
<%
request.setCharacterEncoding("GBK");
String str = request.getParameter("username");
//out.print(str);
if(str.isEmpty()){ //如果输入为空则跳转
// str ="";
out.print("<p>ddddd</p>");
response.sendRedirect("myexampleResponse1.jsp");
}
else{
//str = new String(str.getBytes("ISO8859-1"),"GBK");
}
%>
<p>欢迎 <%=str %> 进入本网页</p>
</body>
</html>