快速业务通道

谈谈对Struts多模块的认识 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-18
type=''text/javascript'' src=''/DWRTest/dwr/interface/BookManageService.js''>< /script> < script type=''text/javascript'' src=''/DWRTest/dwr/engine.js''>< /script> < script type=''text/javascript'' src=''/DWRTest/dwr/util.js''>< /script> < script type="text/javascript"> var bookCache = ...{}; var currentBook = null; function loadAllBooks(){ BookManageService.getAllBooks(handleGetAllBooks,handleGetAllBooksError); } function handleGetAllBooks(books){ dwr.util.removeAllRows("booksBody",{ filter:function(tr) ...{ return (tr.id != "pattern"); }}); var book,id; for(var i = 0; i < books.length; i++){ book = books[i]; id = book.id; dwr.util.cloneNode("pattern", { idSuffix:id }); dwr.util.setValue("t_name" + id, book.name); dwr.util.setValue("t_isbm" + id, book.isbm); dwr.util.setValue("t_author" + id,book.author); $("pattern" + id).style.display = "block"; bookCache[id] = book; } } function handleGetAllBooksError(msg){ alert("Error: " + msg); } function addBook(){ var book = ...{name:null,isbm:null,author:null}; dwr.util.getValues(book); dwr.engine.beginBatch(); BookManageService.addBook(book); loadAllBooks(); dwr.engine.endBatch(); } function editBook(btId){ currentBook = bookCache[btId.substring(4)]; dwr.util.setValues(currentBook); } function updateBook(){ var book = {id:null,name:null,isbm:null,author:null}; dwr.util.getValues(book); book.id = currentBook.id; BookManageService.updateBook(book,handleUpdateBook,handleUpdateBookError); } function handleUpdateBook(){ alert("Update book successfully!"); loadAllBooks(); } function handleUpdateBookError(msg){ alert("Error: " + msg); } function deleteBook(btId){ var i = confirm("Are you sure to delete the book?"); if(i == true) BookManageService.deleteBook(btId.substring(6),handleDeleteBook,handleDeleteBookError); } function handleDeleteBook(){ alert("The book has been delete successfully!"); loadAllBooks(); } function handleDeleteBookError(msg){ alert("Error: " + msg); } < /script> < /head> < body onload="loadAllBooks()"> < div> < h2>Add book< /h2> < table> < tr> < td>Name:< /td>< td>< input type="text" id="name">< /td> < /tr> < tr> < td>ISBN:< /td> < td>< input type="text" id="isbm">< /td> < /tr> < tr> < td>Author:< /td> < td>< input type="text" id="author">< /td> < /tr> < tr> < td colspan="2"> < input type="button" id="add" value="Add" onclick="addBook()"> < input type="button" id="update" value="Update" onclick="updateBook()"> < /td> < /tr> < /table> &l

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号