我正在上课,我只是在玩桌子的滚动条。突然间,我的EL表达式停止了工作。我根本没有触摸我的控制器类。我已经测试了我的模型和控制器中的方法。一切似乎都在运转。这意味着它在某处或类似的东西。但是,我已经到处都是这样,无法找到它。我是EL表达的超级新手,所以我可能会遗漏一些明显的东西。任何帮助将不胜感激。
<%--
Document : Index
Created on : Feb 8, 2016, 12:43:30 PM
Author : andre_000
--%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Book Inventory</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand">Author Inventory</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#collapse-menu">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="collapse-menu">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="index.html">Home</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-8">
<h1>Author Inventory</h1>
<table class="table table-hover active">
<thead>
<tr>
<th>ID</th>
<th>Author Name</th>
<th>Date Added</th>
</tr>
</thead>
<tbody>
<c:forEach var="author" items="${authorList}">
<tr>
<td id=${author.authorId}>
<c:out value="${author.authorId}" />
</td>
<td class="authorname" id="<c:out value="${author.authorName}"/>" >
<c:out value="${author.authorName}"/>
</td>
<td id=${author.dateAdded}>
<c:out value="${author.dateAdded}"/>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<h1>${errorMsg}</h1>
</div>
</div>
</div>
<nav class="navbar navbar-inverse navbar-fixed-bottom">
<div class="container">
<div class="container">
<div class="row">
<div id="add" class="col-md-8">
<form method="POST" action="AuthorController">
<h2 class="toolbar" >Add a new Author</h2>
<label>Enter Name</label>
<input type="text" name="name" value=""/>
<input type="hidden" name="action" value="add" />
<input type="submit" name="submit" value="add" />
</form>
</div>
<div id="editDelete" class="col-md-8">
<form method="POST" action="AreaCalculator" name="Triangle" id="triangle" class="calcBox">
<h2>Edit or Delete?</h2>
<label>Name:</label>
<input id="name" type="text" name="height" value=""/>
<br>
<label>Date Added:</label>
<input id="date" type="text" name="base" value=""/>
<br>
<input type="submit" name="submit" value="Submit"/>
<input type="hidden" name="shapeID" value="TRIANGLE" />
</form>
</div>
<div class="col-md-4">
<form method="POST" action="AreaCalculator" name="Circle" id="circle" class="calcBox">
<h2>Circle Calculator</h2>
<label>Enter Radius</label>
<input type="text" name="radius" value=""/>
<br>
<br>
<input type="submit" name="submit" value="Submit"/>
<input type="hidden" name="shapeID" value="CIRCLE" />
</form>
</div>
</div>
</div>
<p class="navbar-text"><i>© 2016 Andrew Wintermyer</i></p>
</div>
</nav>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
var name;
$('#editDelete').hide();
$('.authorname').click(function () {
name = $(this).attr('id');
});
$('.table > tbody > tr').click(function () {
$('#editDelete').show();
$('#add').hide();
$('#name').val(name);
$('#date').val("Today");
});
});
</script>
</body>
我甚至将我的项目还原为早期工作的github提交而没有任何内容。
答案 0 :(得分:0)
答案是,我没有保护我的addrecord方法不将空记录添加到我的表中。一旦进入那里,他们真的搞砸了我的getallrecords方法。我真的浪费了一个小时。要学习的教训是验证所有参数,即使您只是在瞎逛。