配置jsp文件
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>首页</title>
</head>
<body>
<h3>
<a href="${pageContext.request.contextPath}/book/allBook">进入书籍页面</a>
</h3>
</body>
</html>
配置Controller
@Controller
@RequestMapping(value = "/book")
public class BookController {
@Autowired
@Qualifier("BookServiceImpl")
private BookService bookService ;
@RequestMapping(value = "/allBook")
public String list(Model model){
List<Books> list = bookService.queryAllBook();
model.addAttribute("list",list);
return "allBook";
}
}
编写“allBook”
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>书记展示</title>
</head>
<body>
<h1>书记展示</h1>
</body>
</html>
这样就交互起来了