Skip to content

sending a list to the html page and then displaying it using thymeleaf gets parsing error

My flightList.html

<!DOCTYPE html >
<html xmlns:th="">
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Matching Flights</title>
                <th>flight No. </th>
                <th>Valid till</th>
                <th>Departure Time</th>
            <tr th:each="listvalue : ${list}">
                <td th:text="${listValue.flight_no}"> </td>
                <td th:text="${listvalue.valid_till}"></td>
                <td th:text= "${listValue.flight_time}"> </td>
                <td th:text= " ${listValue.flight_dur}"> </td>
                <td th:text= " ${listValue.fare}"> </td>

Controller Class for url mapping

public class FlightCont {
    public void initBinder(WebDataBinder binder){
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        binder.registerCustomEditor(Date.class,"flightDate",new CustomDateEditor(dateFormat, false));
    @RequestMapping(value ="/flightSearch" , method=RequestMethod.POST)
    public ModelAndView flightSearch(@Valid @ModelAttribute("flightDetails")FlightDetailsEntered flightDetails,BindingResult result){
        ModelAndView modelAndView =new ModelAndView("flightSearch");
            return modelAndView ;
        List<Flight> listOfMatchingFlights= flightDetails.getListOfMatchingFlights();
        for(Flight f:listOfMatchingFlights) {
        modelAndView = new ModelAndView("flightList");
        modelAndView.addObject("list", listOfMatchingFlights);
        return modelAndView ;

Flight class

        @Table(name = "flights")
        public class Flight {
            private int id;
        //    @Column(name="flight_no")
            private  String flight_no;
        //    @Column(name="dep_loc")
            private String dep_loc;
        //    @Column(name="arr_loc")
            private String arr_loc;
        //    @Column(name="valid_till")
            @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd-MM-yyyy")
            private Date valid_till;
        //    @Column(name="flight_time")
            private int flight_time;
        //    @Column(name="flight_dur")
            private double flight_dur;
        //    @Column(name="fare")
            private int fare;
        //    @Column(name="seat_availability")
            private boolean seat_availability;
        //    @Column(name="flight_class")
            private String flight_class;
    public int getId() {
        return id;

    public void setId(int id) { = id;

    public void setSeat_availability(boolean seat_availability) {
        this.seat_availability = seat_availability;

    public String getFlight_no() {
        return flight_no;

    public void setFlight_no(String flight_no) {
        this.flight_no = flight_no;

    public String getDep_loc() {
        return dep_loc;

    public void setDep_loc(String dep_loc) {
        this.dep_loc = dep_loc;

    public String getArr_loc() {
        return arr_loc;

    public void setArr_loc(String arr_loc) {
        this.arr_loc = arr_loc;

    public Date getValid_till() {
        return valid_till;

    public void setValid_till(Date valid_till) {
        this.valid_till = valid_till;

    public int getFlight_time() {
        return flight_time;

    public void setFlight_time(int flight_time) {
        this.flight_time = flight_time;

    public double getFlight_dur() {
        return flight_dur;

    public void setFlight_dur(double flight_dur) {
        this.flight_dur = flight_dur;

    public int getFare() {
        return fare;

    public void setFare(int fare) {
        this.fare = fare;

    public boolean isSeat_availability() {
        return seat_availability;
//    public void setSeat_availability(boolean seat_availability) {
//        this.seat_availability = seat_availability;
//    }

    public String getFlight_class() {
        return flight_class;

    public void setFlight_class(String flight_class) {
        this.flight_class = flight_class;


I am passing list to my flightList.html to display data in that list in a html table but when i load that page i get

An error happened during template parsing (template: "class path resource [templates/flightList.html]")
org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/flightList.html]")

idk why it is unable to parse the data when I display the data in list to console (doing System.out.println) it works fine if anybody have any suggestions or what might be wrong it would be really helpful


error stack :


You have written listvalue with upper V and lower v