単純なページリダイレクトの例です。ボタンリダイレクトページをクリックすると、動作しません。ページが見つかりません。 finalpage:リダイレクト中/不在Spring MVCリダイレクトページ
final.jsp
<body>
<h2>Redirected Page</h2>
</body>
HelloController.java
@Controller
public class HelloController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(Model m) {
return "index";
}
@RequestMapping(value = "/redirect", method = RequestMethod.GET)
public String redirect() {
return "redirect:finalPage";
}
@RequestMapping(value = "/finalPage", method = RequestMethod.GET)
public String finalPage(Model m) {
return "final";
}
index.jspを
<body>
<h2>Spring Page Redirection</h2>
<p>Click below button to redirect the result to new page</p>
<form:form method="GET" action="/finalPage">
<table>
<tr>
<td>
<input type="submit" value="Redirect Page"/>
</td>
</tr>
</table>
</form:form>
</body>
のweb.xml