当前位置: 代码迷 >> Java Web开发 >> 关于<%@include file="/inc/head.jsp" %>的有关问题
  详细解决方案

关于<%@include file="/inc/head.jsp" %>的有关问题

热度:1127   发布时间:2016-04-17 11:04:26.0
关于<%@include file="/inc/head.jsp" %>的问题
<%@page contentType="text/html;charset=gbk" %>
<jsp:directive.page import="com.runwit.books.db.AuthorDAO"/>
<jsp:directive.page import="java.util.List"/>
<jsp:directive.page import="com.runwit.books.model.AuthorModel"/>
<jsp:directive.page import="com.runwit.common.util.PageUtil"/>
<%@include file="/checkLoginSession.jsp" %>
<%
AuthorDAO dao = new AuthorDAO();
List<AuthorModel> authors = dao.queryAll();
%>
<html>
<head>
<title>朗慧图书管理信息系统-作者管理</title>
<link rel=stylesheet href="../inc/main.css" type="text/css">
<style type="text/css">
</style>
<script type="text/javascript">
function checkForm(myform){
var fName = myform.firstName.value;
var lName = myform.lastName.value;
if(fName == "") {
alert('名不能为空!');
myform.firstName.focus();
return false;
}
if(lName == "") {
alert('姓不能为空!');
myform.lastName.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<%@include file="/inc/head.jsp" %>--------------------- 这行有错误!
<form action="add.jsp" method="post" name="form1" onsubmit="return checkForm(this);">
<table align="center" width="980">
<tr>
<td>
名 <input type="text" name="firstName" size="20">
姓 <input type="text" name="lastName" size="20">
<input type="submit" value="添加新作者">
</td>
</tr>
</table>
</form>
<table align="center" width="980">
<caption>作者列表</caption>
<tr>
<th width="150">作者ID</th>
<th width="300">名</th>
<th width="300">姓</th>
<th width="230">操作</th>
</tr>
<%
int pageSize = 10; //每页显示条数
int recordCount = authors.size(); //记录总数

String currentPageStr = request.getParameter("page"); 
int currentPage = 1; //当前页
if(currentPageStr != null) {
currentPage = Integer.parseInt(currentPageStr);
}

PageUtil pageUtil = new PageUtil(pageSize, recordCount, currentPage);


%>
<%
for(int i=pageUtil.getFromIndex(); i<pageUtil.getToIndex(); i++) {
AuthorModel model = authors.get(i);
%>
<tr>
<td width="150"><%=model.getAuthorId()%></td>
<td width="300"><%=model.getFirstName() %></td>
<td width="300"><%=model.getLastName() %></td>
<td width="230"><a href="modify.jsp?id=<%=model.getAuthorId() %>">修改</a> | <a href="delete.jsp?id=<%=model.getAuthorId() %>" onclick="return confirm('确定要删除该记录[作者ID:<%=model.getAuthorId() %>]吗?');">删除</a></td>
</tr>
<%
}

%>
<tr>
<td colspan="8" align="right">
记录总数 <%=recordCount %> 条 每页显示 <%=pageSize %> 条 当前页/总页数 <%=pageUtil.getCurrentPage() %>/<%=pageUtil.getPageCount() %>  
<a href="index.jsp?page=1">首页</a>  
<a href="index.jsp?page=<%=pageUtil.getPrevPage() %>">上页</a> 
  相关解决方案