12
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP '1.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <script type="text/javascript"> function dologin(){ if(loginform.uname.value==""){ alert("没有输入用户名"); return; } if(loginform.upwd.value==""){ alert("没有输入密码"); return; } loginform.submit(); } </script> <form action="1.jsp" name="loginform" method="post"> 用户名:<input type="text" value="zs" name="uname"/></br> 密码:<input type="password" value="11" name="upwd"/></br> <input type="button" value="登录" onclick="dologin()"/> <a href="2.jsp">没有账号?立即注册</a> </form> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP '2.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <script type="text/javascript"> function dozhuce(){ if(loginform2.uname.value==""){ alert("没有输入用户名"); return; } if(loginform2.upwd.value==""){ alert("没有输入密码"); return; } if(loginform2.upwd2.value==""){ alert("没有确认密码"); return; } loginform2.submit(); } function backle(){ history.go(-1); } </script> <form action="2.jsp" name="loginform2" method="post"> 用户名:<input type="text" value="zs" name="uname"/></br> 密码:<input type="password" value="11" name="upwd"/></br> 确认密码:<input type="password" value="11" name="upwd2"/></br> <input type="button" value="注册" onclick="dozhuce()"/> <input type="button" value="返回登录" onclick="backle()"/> </form> </body> </html>