0
Ich versuche, Daten aus der Datenbank zu holen und zeigt sie in dropdwonlistjavax.servlet.jsp.JspException: Typ [java.lang.String] ist nicht gültig für die Option Artikel
DAO
public List<String> getAllDeparment() {
String sql = "select dept_name from DEPATMENT";
return jdbcTemplate.queryForList(sql, String.class);}
Dienst
public List<String> getAllDept(){
return departmentDao.getAllDeparment();
}
-Controller
@RequestMapping(method = RequestMethod.GET, path = "/drop")
public String drop(@ModelAttribute Depatment depatment ,Model model){
List<String> allDept = deparmentServcies.getAllDept();
model.addAttribute("deptlist",allDept);
return "drop";
}
jsp
<form:form commandName="depatment " method="post">
<form:select path="deptName">
<form:options items="${deptlist}" />
</form:select>