I have a problem that should be straight forward and I'm clearly doing something wrong. I have a simple site written in Spring MVC. My JSP model doesn't know my NewItem class..
@RequestMapping(value = "/", method = RequestMethod.GET)
public String newsFeed(Model model) {
try {
initDB();
} catch (Exception e) {
e.printStackTrace();
}
ScanRequest scanRequest = new ScanRequest()
.withTableName("Table1");
ScanResult result = _database.get(scanRequest);
//This will just return a list with filled NewsItems from the database
List<NewsItem> list = getNewsItems(result.getItems());
model.addAttribute("newsList",list);
return "newsfeed";
}
public class NewsItem {
private String url="";
String getUrl(){
return url;
}
void setUrl(String text) {
url = text;
}
private String title="";
void setTitle(String text) {
title = text;
Image = text;
}
String getTitle(){
return title;
}
String Description="";
String Image="";
String Time="";
String Since="";
}
And when im using ${newsList.getTile()} on the JSP side im getting a javax.servlet.jsp.JspException: javax.el.MethodNotFoundException: Method not found: class java.util.ArrayList.getTile() or java.lang.NumberFormatException: For input string:.. when Im trying to use ${newsList.Image}. Does anyone know what Im missing here?
stuff im using in jsp. taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" taglib prefix="spring" uri="http://www.springframework.org/tags" taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" page import="com.kiiak.tennman.NewsItem"