用Java制作简单的登录界面

<%@ 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 'login.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">
    -->
    <script type="text/javascript">
    function Login(){
    var form = document.forms[0];
    form.action = "<%=basePath%>user/login";
    form.method = "post";
    form.submit();
    }    
    </script>
  </head>
 
  <body>
    <form action="" name="loginForm">
        用户名:<input type="text" name="username" id="username"
        placeholder="请输入账户" required="required"/>
        <font color="red">${unameErr }</font>
        <br/>
        密    码:<input type="password" name="pwd" id="pwd"
        placeholder="请输入密码" required="required"/>
        <font color="red">${pwdErr }</font>
        <br/>    
        <input type="button" value="登录" onclick="Login()"/>    
    </form>
  </body>
</html>

posted @ 2017-08-17 02:06  逍遥魔灵  阅读(378)  评论(0编辑  收藏  举报