ssm整合拦截器JSP界面

来源:互联网 发布:dnf无限网络中断2017 编辑:程序博客网 时间:2024/06/05 22:47
<%@ 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>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
      <script type="text/javascript">
          $(function(){
              $("#name").blur(function(){
                  var name=$(this).val();
                  $("#sname").empty();
                  if(name==null || name==""){
                      $(this).after("<span id='sname'><font color='red'>用户名不能为空!</font></span>");
                      name_flag=false;
                  }else{
                      name_flag=true;
                  }
              });
              $("#password").blur(function(){
                  var password=$(this).val();
                  $("#spassword").empty();
                  if(password==null || password==""){
                      $(this).after("<span id='spassword'><font color='red'>密码不能为空!</font></span>")
                      password_flag=false;
                  }else{
                      password_flag=true;
                  }
              });
            $("#login").click(function(){
                if(name_flag&&password_flag){
                    $.post("${pageContext.request.contextPath }/user/login",$("form").serialize(),
                    function(d){
                        if(d=="ok"){
                            location.href="${pageContext.request.contextPath }/person/queryAll";
                        }else{
                            $("span").empty();
                            $("#error").text("用户名或密码错误!");
                        }
                    },"json"
                    );
                }else{
                    alert("请填写登录信息!");
                }
                
            });
        });
      </script>
  </head>
 
  <body>
    <center><h1>用户登录</h1></center><br/><br/>
    <div><font color="red"><span id="error"></span></font></div><br/>
    <form>
        用户名:<input type="text" name="name" id="name"/><br/>
        密码:<input type="password" name="password" id="password"/><br/>
        <input type="button" value="登录" id="login"/><br/><br/>
        <a href="register.jsp"><span>还没注册?请注册!</span></a>
    </form>
  </body>

</html>





<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
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>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
      <script type="text/javascript">
          $(function(){
            $("#ch").click(function(){
                $("input[type='checkbox']:gt(0)").attr("checked",this.checked);
            });
            
            $(".delete").click(function(){
                window.confirm("确定删除?");
            });
            $("#betchDelete").click(function(){
                var array=new Array();
                $("input[type='checkbox']:gt(0):checked").each(function(){
                    array.push($(this).parent().next().text());
                });
                if(array.length!=0){
                    alert(array);
                    location.reload();
                    //$.post("url","array="+array,function(){},"json");
                }else{
                    alert("请选择要删除的数据");
                }
            });
        });
      </script>
  </head>
  <center>
  <body>
    <h1>通讯信息列表</h1><br/><br/>
       按用户名查询:<input type="text" name="name"/>&nbsp;&nbsp;按电话号码查询:<input type="text" name="phoneNumber"/>
       &nbsp;&nbsp;<input type="button" value="查询" id="query"/>
       &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="批量删除" id="betchDelete"/>
       <br/><br/>
    <table border="1" width="60%">
        <tr>
            <th><input type="checkbox" id="ch"></th>
            <th>id</th>
            <th>姓名</th>
            <th>电话号码</th>
            <th>地址</th>
            <th>邮箱</th>
            <th>数据操作</th>
        </tr>
        <c:forEach items="${requestScope.list }" var="a">
            <tr>
                <td align="center"><input type="checkbox"></td>
                <td align="center">${a.id }</td>
                <td align="center">${a.name }</td>
                <td align="center">${a.tel }</td>
                <td align="center">${a.address }</td>
                <td align="center">${a.email }</td>
                <td align="center">
                    <input type="button" value="删除" class="delete">
                    <input type="button" value="修改">
                </td>
            </tr>
        </c:forEach>
    </table><br/><br/><br/>
    每页显示:<select>
        <option>4</option>
        <option>6</option>
        <option>8</option>
        <option>10</option>
    </select>&nbsp;&nbsp;
    <a href="" >首页</a>&nbsp;&nbsp;
    <a href="" >1</a>&nbsp;&nbsp;
    <a href="" >2</a>&nbsp;&nbsp;
    <a href="" >3</a>&nbsp;&nbsp;
    <a href="" >4</a>&nbsp;&nbsp;
    <a href="" >5</a>&nbsp;&nbsp;
    <a href="" >末页</a>&nbsp;&nbsp;
    跳转到:<select>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
    </select>页
  </body>
  </center>
</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>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
      <script type="text/javascript">
          $(function(){
              $("#name").blur(function(){
                  $("#sname").empty();
                  var name=$(this).val();
                  if(name==null || name==""){
                      $("#name").after("<span id='sname'><font color='red'>用户名不能为空!</font></span>")
                      name_flag=false;
                  }else{
                      $.post("${pageContext.request.contextPath }/user/isExist","name="+name,
                    function(d){
                        if(d=="error"){
                            $("#name").after("<span id='sname'><font color='red'>用户名已经存在!</font></span>")
                            name_flag=false;
                        }else{
                            name_flag=true;
                        }
                    },"json"
                    );
                  }
                  
              });
              $("#password").blur(function(){
                  var password=$(this).val();
                  $("#spassword").empty();
                  if(password==null || password==""){
                      $(this).after("<span id='spassword'><font color='red'>密码不能为空!</font></span>");
                      password_flag=false;
                  }else{
                      password_flag=true;
                  }
              });
              $("#email").blur(function(){
                  var email=$(this).val();
                  $("#semail").empty();
                  if(email==null || email==""){
                      $(this).after("<span id='semail'><font color='red'>邮箱不能为空!</font></span>");
                      email_flag=false;
                  }else{
                      email_flag=true;
                  }
              });
            $("#register").click(function(){
                if(name_flag&&password_flag&&email_flag){
                    $.post("${pageContext.request.contextPath }/user/register",$("form").serialize(),
                    function(d){
                        if(d=="ok"){
                            location.href="${pageContext.request.contextPath }/registerOk.jsp";
                        }else{
                            alert("注册失败!");
                            location.reload();
                        }
                    },"json"
                    );
                }else{
                    alert("请填写注册信息!");
                }
                
            });
        });
      </script>
  </head>
 
  <body>
    <h1>用户注册</h1><br/><br/>
    <div><font color="red"><span id="error"></span></font></div><br/>
    <form>
        用户名:<input type="text" name="name" id="name"/><br/>
        密码:<input type="password" name="password" id="password"/><br/>
        邮箱:<input type="email" name="email" id="email"/><br/>
        <input type="button" value="注册" id="register"/>
    </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>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.3.js"></script>
      <script type="text/javascript">
          window.setTimeout(function(){
              location.href="${pageContext.request.contextPath}/login.jsp";
          },3000);
      </script>
  </head>
 
  <body>
    <center><h4>注册成功,三秒钟后跳转到登录页面...</h4></center>
  </body>
</html>