http://rosspc:8080/JspLibrary/
1. logon界面解析:
JS 验证用户名、密码为空
<form name="form1" method="post" action="manager.do?action=login"> <input name="name" type="text" class="logininput" id="name" size="27"> <input name="pwd" type="password" class="logininput" id="pwd" size="27"> <input name="Submit" type="submit" class="btn_grey" value="确定" onClick="return check(form1)"> </form>
function check(form){ if (form.name.value==""){ alert("请输入管理员名称!");form.name.focus();return false; } if (form.pwd.value==""){ alert("请输入密码!");form.pwd.focus();return false; } }
重置用户名、密码:
<input name="Submit3" type="reset" class="btn_grey" value="重置">
2.main.jsp解析
引用其他jsp文件
<%@include file="banner.jsp"%> <%@include file="navigation.jsp"%>
直接在jsp页面中调用DAO
<% BorrowDAO borrowDAO=new BorrowDAO(); Collection coll_book=(Collection)borrowDAO.bookBorrowSort(); %>
html夹杂java代码
<%if(coll_book!=null && !coll_book.isEmpty()){ Iterator it_book=coll_book.iterator(); int i=1; int degree=0; String bookname=""; String typename=""; String barcode_book=""; String bookcase=""; String pub=""; String author=""; String translator=""; Float price=new Float(0); while(it_book.hasNext() && i<6){ BorrowForm borrowForm=(BorrowForm)it_book.next(); bookname=borrowForm.getBookName(); barcode_book=borrowForm.getBookBarcode(); typename=borrowForm.getBookType(); degree=borrowForm.getDegree(); bookcase=borrowForm.getBookcaseName(); pub=borrowForm.getPubName(); author=borrowForm.getAuthor(); price=borrowForm.getPrice(); %> <tr> <td height="25" align="center"><%=i%></td> <td style="padding:5px;"> <%=barcode_book%></td> <td style="padding:5px;"><%=bookname%></td> <td style="padding:5px;"><%=typename%></td> <td align="center"> <%=bookcase%></td> <td align="center"> <%=pub%></td> <td width="11%" align="center"><%=author%></td> <td width="8%" align="center"><%=price%></td> <td width="8%" align="center"><%=degree%></td> </tr> <% i++; } }%>
小图片作为超链接
<a href=borrow.do?action=bookBorrowSort><img src="Images/more.GIF" width="50" height="20" border="0"> </a>
时间: 2024-11-01 11:06:39