首页 > 代码库 > c/s用户与服务器之间的传输
c/s用户与服务器之间的传输
####第一页
<%@ 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="do.jsp" method="post">
请输入您的电话号码:<input type="text" name="num" ><!-- value="http://www.mamicode.com/number"有点问题 --><br/>
请输入您的充值金额:<input type="text" name="num1" ><br/>
<input type="submit" value="http://www.mamicode.com/充值">
</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>
<% request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String numbers=request.getParameter("num");
if(numbers==null||numbers.trim().equals("")||numbers.length()!=11){
//成功
response.sendRedirect("chongzhi.jsp");
}else{
//失败
System.out.println(1);
request.getRequestDispatcher("seccess.jsp").forward(request, response);
}
%>
</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>您的电话号码: <%=request.getParameter("num") %>充值成功!</h3>
</body>
</html>
这些代码需要用到Server,是用户与服务器之间的信息传输
c/s用户与服务器之间的传输