Ошибка в контроллере
Суть проблемы такая: при написании контроллера, столкнулся с его некорректной работой - он возвращает ошибку, подскажите пожалуйста почему появляется данная ошибка и как ее исправить. Заранее благодарю.
Ошибка: org.springframework.web.bind.UnsatisfiedServletRequestParameterException: Parameter conditions "id" not met for actual request parameters
Код контроллера:
package ru.vegd.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import ru.vegd.service.NewsService;
import java.sql.SQLException;
@Controller
public class NewsReadController {
@Autowired
NewsService newsService;
@RequestMapping(value = "/news/{id}", method = RequestMethod.GET, params = {"id"})
public String singleNews( @RequestParam(name="id", required = true) Long id, Model model) throws SQLException {
System.out.println(id);
model.addAttribute("news", newsService.read(id));
return "news/readOne";
}
}
readOne.html:
<style type="text/css">
table {
border-spacing: 0 10px;
font-family: 'Open Sans', sans-serif;
font-weight: bold;
}
th {
padding: 10px 20px;
background: #56433D;
color: #F9C941;
border-right: 2px solid;
font-size: 0.9em;
}
td {
vertical-align: middle;
padding: 10px;
font-size: 14px;
text-align: center;
border-top: 2px solid #56433D;
border-bottom: 2px solid #56433D;
border-right: 2px solid #56433D;
}
td:first-child {
border-left: 2px solid #56433D;
}
td:nth-child(2){
text-align: left;
}
td:nth-child(4){
font-size: 20px;
text-align: left;
padding: 10px;
font-size: 14px;
}
</style>
<table xmlns:th="http://www.w3.org/1999/xhtml">
<thead>
<tr>
<th> ID </th>
<th> Author </th>
<th> Title </th>
<th> News </th>
</tr>
</thead>
<tbody>
<tr>
<td><span th:text="${news.news_id}"> ID </span></td>
<td><span th:text="${news.author_id}"> Author </span></td>
<td><span th:text="${news.tittle}"> Tittle </span></td>
<td><span th:text="${news.news_text}"> News </span></td>
</tr>
</tbody>
</table>
Ссылка: http://localhost:8080/news/2