I'm following the Spring MVC course from VirtualPairProgrammers and the workspace they have provided seems to have some issues. I'm getting the following error when I run the code.
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the generated java file The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
Any ideas what is going wrong? This is the code in my controller:
@RequestMapping("/viewAllBooks")
public ModelAndView viewAllBooks()
{
List<Book> allBooks = bookService.getEntireCatalogue();
return new ModelAndView("/displayAllBooks.jsp","allBooks",allBooks);
}
And this is the JSP file:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<title>All books for our store</title>
<link href="styles.css" rel="Stylesheet" type="text/css"/>
</head>
<body>
<jsp:include page="/web/header.jsp"/>
<div id="books">
<ul>
<c:forEach items="${allBooks}" var="nextBook">
<li>
<h2>${nextBook.title}</h2>
<p>
<span> by ${nextBook.author}
<fmt:formatNumber value="${nextBook.price}"
type="currency"
currencyCode="USD" />
<form method='post' action='<c:url value=""/>'>
<input type='hidden' name='id' value='${nextBook.id}'/>
<input type='image' src='cart-button.png'/>
</form>
</span>
</p>
</li>
</c:forEach>
</ul>
</div>
<jsp:include page="/web/footer.jsp"/>
</body>
</html>