如果按下按钮,我希望执行 showEnteredData 方法。但它不执行该功能。我认为它应该自动完成。问题是什么?感谢您的帮助:=)
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false"%>
<div id="leer" style="float: left;"></div>
<div class="filmFilter">
<form action="articles" method="get">
<select name="dropdownFilmeFilter">
<option value="aufsteigend">Preis: aufsteigend</option>
<option value="absteigend">Preis: absteigend</option>
<option value="bewertung">Kundenbewertung</option>
<option value="erscheinungsdatum">Erscheinungsdatum</option>
</select>
<input type="submit" value="Done" /> <a href="home">bring me back
home</a>
</form>
</div>
@RequestMapping(value = "/articles")
public String showHome ( Model model){
List<Article> article = (List<Article>) gd.findAll(Article.class);
model.addAttribute("articles", article);
return "articles";
}
@RequestMapping(value = "/articles", method = RequestMethod.POST)
public String showEnteredData(@RequestParam("dropdownFilmeFilter") String filter, Model model) {
System.err.println("hohooh");
List<Article> article = (List<Article>) gd.sortByAttribute(Article.class, "price", true);
article.clear();
if (filter == "aufsteigend"){
article = (List<Article>) gd.sortByAttribute(Article.class, "price", true);
}
model.addAttribute("articles", article);
return "articles";
}