bootsharp+springmvc+ibatis+mysql(4)
<%@ 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(채소새의 천국, 대신이 들어오지 않음)
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.