bootsharp+springmvc+ibatis+mysql(4)

9782 단어
home.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Ibatis System</title>
	<link  rel="stylesheet" href="resource/css/style.css" type="text/css" />
	<link  rel="stylesheet" href="resource/css/bootstrap.min.css"  type="text/css" />
	<link  rel="stylesheet" href="resource/css/bootstrap-theme.min.css"  type="text/css" />
	<link  rel="stylesheet" href="resource/css/ibatis.css" type="text/css" />
	<link  rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
	<style>
		.error{
			color:red
		}
	</style>
</head>
<body style="padding:10px;">

Index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="/include/home.jsp"></jsp:include>
      <div class="center-block">
      <p align="center"><font color="red" size="10"> </font></p>
      		<a href="user/toadd"><button type="button" class="btn btn-primary btn-xs"> </button></a><br>
				<table class="table" style="text-align:center">
					<tr> 
						<th style="text-align:center"> </th>
						<th style="text-align:center"> </th>
						<th style="text-align:center"> </th>
						<th style="text-align:center"> </th>
					 </tr>
					<c:forEach var="user" items="${userlist }" >
					 <tr>
					     <td>${user.userId }</td>
					     <td>${user.userName }</td>
					     <td>${user.age }</td>
					     <td>
						     <a href="user/toUpdate?id=${user.userId }"><button type="button" class="btn btn-success btn-xs"> </button></a>
						     <!--  <a href="user/del?id=${user.userId }"><button type="button" class="btn btn-danger btn-xs"> </button></a>--> 
						     <button  type="button" class="btn btn-danger btn-xs"  onclick="falseDel(${user.userId})" > </button>
					     </td>
					  </tr>    
					  </c:forEach>
					  <tr>
					  	<td td width=100%  colspan=4 align="left">
					  	<a href="movie/movielist"> </a>
					  	</td>
					  </tr>
					  <tr>
					  	<td td width=100%  colspan=4 align="right">
					  	<ul class="pagination" id="pagination1"></ul><br>
					  		<font id="p1"></font> ${sumTotal} 
					  		<input type="hidden" id="sumpage" value="${sumPage}">
					  		<input type="hidden" id="sumtotal" value="${sumTotal}">
					  	</td>
					  </tr>
				</table>
   	 </div>
<script src="resource/js/jquery-1.11.2.min.js"></script>
<script src="resource/js/jqPaginator.js"></script>
<script type="text/javascript">
	
		$.jqPaginator('#pagination1',{
	    	// 
	        //totalPages: 4,
	        // 
	        visiblePages: 10,
	        // 
	        currentPage: 1,
	        // 
	        totalCounts:40,
	        // 
	        pageSize:8,
	        onPageChange: function (num, type) {
	            $('#p1').text( ' '+ num+' ');
	        }
	    });
		
    	function falseDel(id){
    		
    		if(confirm(" ?")){
    			
        		$.ajax({
        			url:'/spring_ibatis/user/falseDel?id='+id,
        			type:'get',
        			cache:false,
        			success:function(data){
        				
        				if(data="success"){
        					
        					alert(" !");
        					
        					window.location.href="/spring_ibatis/user/index";
        				}else{
        					
        					alert(" !");
        				}
        			},
        			error:function(data){
        				
        				alert(" , !");
        			}
        			
        		});
    		}
    		
    	};
</script>
 </body>
</html>

add.jsp
<%@ 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">
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<title>Insert title here</title>
</head>
<body>
 <table>
    <input type="hidden" id="flag" value="1">
     <tr>
       <td>
                           :
       </td>
       <td>
         <input type="text" id="name">
       </td>
     </tr>
     <tr>
       <td>
                           :
       </td>
       <td>
         <input type="text" id="age">
       </td>
     </tr>
     <tr>
       <td colspan="2">
           <input type="button" value=" " onclick="add()">
       </td>
      
     </tr>
  
  </table>
  <script type="text/javascript">
    function add(){
    	var name=$("#name").val();
    	var age=$("#age").val();
    	var flag=$("#flag").val();
    	$.ajax({     
    	    url:encodeURI(encodeURI('/spring_ibatis/user/add?name='+name+'&age='+age+'&flag='+flag)),      
    	    type:'get',    
    	    cache:false,  
    	    success:function(data) {     
    	      if(data =="su" ){  
    	            
    	           window.location.href="/spring_ibatis/user/index";
    	      }else{     
    	            
    	            alert(" ! !");   
    	       }     
    	     },     
    	    error : function() {  
    	          alert(" , !");     
    	      }});   

    	
    }
  
  
  </script>
</body>
</html>

Userinfo.jsp
<%@ 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">
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<title>Insert title here</title>
</head>
<body>
  <table>
  	 <input type="hidden" id="flag" value="${user.flag }">
  	 <input type="hidden" id="id" value="${user.userId }" readonly="readonly">
     <tr>
       <td>
                           :
       </td>
       <td>
       ${user.userId}
       </td>
     </tr>
     <tr>
       <td>
                           :
       </td>
       <td>
         <input type="text" id="name" value="${user.userName }" >
       </td>
     </tr>
     <tr>
       <td>
                           :
       </td>
       <td>
         <input type="text" id="age" value="${user.age }">
       </td>
     </tr>
    <tr>
      <td colspan="2">
      <input type="button" value=" "  onclick="modify()">
      </td>
    </tr>
  
  </table>
   <script type="text/javascript">
    function modify(){
    	var name=$("#name").val();
    	var age=$("#age").val();
    	var id=$("#id").val();
    	var flag=$("#flag").val();
    	$.ajax({     
    	    url:encodeURI(encodeURI('/spring_ibatis/user/update?userName='+name+'&age='+age+'&userId='+id+'&flag='+flag)),      
    	    type:'get',    
    	    cache:false,  
    	    success:function(data) {     
    	      if(data =="su" ){  
    	           alert(" !"); 
    	           window.location.href="/spring_ibatis/user/index";
    	      }else{     
    	          
    	            alert(" ! !");   
    	       }     
    	     },     
    	    error : function() {  
    	          alert(" , !");     
    	      }});   

    	
    }
  
  
  </script>
</body>
</html>

블로거의 기초군: 260052172(채소새의 천국, 대신이 들어오지 않음)

좋은 웹페이지 즐겨찾기