####第一頁 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitiona ...
####第一頁
<%@ 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,是用戶與伺服器之間的信息傳輸