第七次作业
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 5 6 <title>My JSP 'MyJsp1.jsp' starting page</title> 7 8 9 10 </head> 11 12 <body bgcolor=#ffccff> 13 <% double price=98.78 ;%> 14 <p style="font-family:宋体;font-size:36;color:blue"> 15 商品编号A1001,价格 8765 16 <a href="receive.jsp?id=A1001&price=8765">购买</a><br> 17 商品编号A1002,价格<%=price %> 18 <a href="receive.jsp?id=A1002&price=<%=price %>">购买</a> 19 </p> 20 21 22 </body> 23 </html>
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 5 <title>My JSP 'index.jsp' starting page</title> 6 7 </head> 8 9 <body> 10 11 <% 12 request.setCharacterEncoding("utf-8"); 13 String zh=request.getParameter("zh"); 14 String upwd=request.getParameter("upwd"); 15 if(zh.equals(upwd)){ 16 response.sendRedirect("trium.jsp"); 17 } 18 else{ 19 response.sendRedirect("lose.jsp"); 20 } 21 22 %> 23 24 25 </body> 26 </html>
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 5 6 <title>My JSP 'input.jsp' starting page</title> 7 8 9 10 </head> 11 12 <body bgcolor=#ffccff> 13 <form action="count.jsp"method=post name=form> 14 <p style="font-family:宋体;font-size:18;color:blue"> 15 输入运算数,选择运算符号:<br> 16 <input type=text name="numberone"size=6/> 17 <select name="operator"> 18 <option selected="selected"value="+">加 19 <option value="-">减 20 <option value="*">乘 21 <option value="/">除 22 23 </select> 24 <input type=text name="numbertwo"size=6/> 25 <input type="submit" name="submit"value="提交"/> 26 27 28 </form> 29 </p> 30 </body> 31 </html>
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 5 6 <title>My JSP 'count.jsp' starting page</title> 7 8 9 10 </head> 11 12 <body bgcolor="cyan"> 13 <p style="font-family:宋体;font-size:18;color:black"> 14 <% 15 String number1=request.getParameter("numberone"); 16 String number2=request.getParameter("numbertwo"); 17 String operator=request.getParameter("operator"); 18 if(number1==null||number1.length()==0){ 19 response.sendRedirect("input.jsp"); 20 return;} 21 else if(number2==null||number2.length()==0){ 22 response.sendRedirect("input.jsp"); 23 return;} 24 try{ 25 double a=Double.parseDouble(number1); 26 double b=Double.parseDouble(number2); 27 double r=0; 28 if(operator.equals("+")) 29 r=a+b; 30 else if(operator.equals("-")) 31 r=a-b; 32 else if(operator.equals("*")) 33 r=a*b; 34 else if(operator.equals("/")) 35 r=a/b; 36 out.print(a+""+operator+""+b+"="+r); 37 } 38 catch(Exception e){ 39 out.println("请输入数字字符"); 40 41 } 42 43 %> 44 45 46 </body> 47 </html>
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 <html> 3 <head> 4 5 </head> 6 7 <body> 8 <form action="regist.jsp" method="post"> 9 10 账号:<input type="text" name="zh" /><br> 11 密码: <input type="password" name="upwd" ><br> 12 <input type="submit" value="提交"/> 13 <input type="reset" value="重置"/> 14 </form> 15 </body> 16 </html>
1 <html> 2 <head> 3 4 <title>My JSP 'index.jsp' starting page</title> 5 6 </head> 7 8 <body> 9 10 <% 11 request.setCharacterEncoding("utf-8"); 12 String zh=request.getParameter("zh"); 13 String upwd=request.getParameter("upwd"); 14 if(zh.equals(upwd)){ 15 response.sendRedirect("trium.jsp"); 16 } 17 else{ 18 response.sendRedirect("lose.jsp"); 19 } 20 21 %> 22 23 24 </body> 25 </html> 26 <html> 27 <head> 28 29 30 <title>My JSP 'trium.jsp' starting page</title> 31
32
33 </head> 34 35 <body> 36 登录成功! <br> 37 </body> 38 </html> 39 <html> 40 <head> 41 42 43 <title>My JSP 'lose.jsp' starting page</title> 44 45 46 47 </head> 48 49 <body> 50 登录失败! <br> 51 </body> 52 </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <form action="regist.jsp" method="post"> 账号:<input type="text" name="zh" /><br> 密码: <input type="password" name="upwd" ><br> 是否注册会员<input type="checkbox" name="checkbox" value="是否成为会员"/><br> <input type="submit" value="提交"/> <input type="reset" value="重置"/> </form> </body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'index.jsp' starting page</title> </head> <body> <% request.setCharacterEncoding("utf-8"); String zh=request.getParameter("zh"); String upwd=request.getParameter("upwd"); if(zh.equals(upwd)){ if(request.getParameterValues("checkbox")!=null){ out.print("欢迎您注册为会员!"+"<br>"); } out.print("登陆成功"); } else{ out.print("登陆失败 "); } %> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <form action="regist.jsp" method="post"> <input name="a" type="text" > <input type="submit" value="提交"> </form> </body> </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'index.jsp' starting page</title> </head> <body> <% String q=request.getParameter("a"); int r = Integer.valueOf(q); for(int i = 0 ; i <= r-1 ; i++){ out.println("欢迎"+"<br>"); }%> </body> </html>