如何解决尝试通过使用Spring表单标签库在Spring Boot中从一个JSP文件夹移动到另一个JSP文件夹
好吧,我正在开发spring boot应用程序,并且为了UI页面设计,我正在使用spring form标签库。在index.jsp中,有一个“所有联系人”链接。我的要求是,当我单击“链接所有”联系人时,我想移动到“ viewContact.jsp”页面。但我遇到错误。
请发表评论并帮助我如何解决此问题?
index.jsp
<form:form method="POST" action="/submit" modelAttribute="contact" >
<table align="center" cellpadding="10" cellspacing="10"
bgcolor="#98AFC7">
<tr>
<td>Contact Name</td>
<td><form:input type="text" path="name"/></td>
</tr>
<tr>
<td>Contact Email</td>
<td><form:input type="text" path="email"/></td>
</tr>
<tr>
<td>Contact Number</td>
<td><form:input type="text" path="num"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Register"></td>
</tr>
<tr>
<td><a href="viewAll">All Contacts</a></td>
</tr>
</table>
</form:form>
viewContact.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>View Contacts Form</title>
</head>
<body bgcolor="#BCC6CC">
<h1 align="center">View Contact Form</h1>
<table>
<tr>
<th>Contact Name</th>
<th>Contact Email</th>
<th>Contact Number</th>
</tr>
<c:forEach items="contact" var="contact">
<tr>
<td>${contact.name}</td>
<td>${contact.email}</td>
<td>${contact.cnum}</td>
</tr>
</c:forEach>
</table>
</body>
</html>
contactInfoController.java
@GetMapping("/viewAll")
public String handleviewallContactDtlsLink(Model model) {
List<Contact> allContacts = contactservice.getAllContacts();
model.addAttribute("contact",allContacts);
return "viewContact";
}
错误页面
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。