Well i am developing a spring boot application and for UI page designing i am using spring form tag library. In index.jsp there is a link "All Contacts". My requirement is when i click the Link All contact i want to move to "viewContact.jsp" page. but i am getting an Error.
Please comment and help me how to resolve this issues?
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";
}
