首页 > 其他 > 详细

c/s用户与服务器之间的传输

时间:2016-09-22 08:43:05      阅读:213      评论:0      收藏:0      [点我收藏+]

####第一页

<%@ 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="number"有点问题 --><br/>
请输入您的充值金额:<input type="text" name="num1" ><br/>
<input 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>

<% 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用户与服务器之间的传输

原文:http://www.cnblogs.com/chengxuy/p/5894835.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!