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



My flightList.html

<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Matching Flights</title>
    </head>
    <body>
        <table>
            <tr>
                <th>S.no.</th>
                <th>flight No. </th>
                <th>Valid till</th>
                <th>Departure Time</th>
                <th>Duration</th>
                <th>fare</th>
            </tr>
    
            <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>
            </tr>
        </table>
    </body>
</html>

Controller Class for url mapping

@Controller
public class FlightCont {
        
    @InitBinder
    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");
        if(result.hasErrors())
        { 
            System.err.println(result);
            return modelAndView ;
        }
        List<Flight> listOfMatchingFlights= flightDetails.getListOfMatchingFlights();
        for(Flight f:listOfMatchingFlights) {
            System.out.println(f.getValid_till());
        }
        modelAndView = new ModelAndView("flightList");
        modelAndView.addObject("list", listOfMatchingFlights);
        return modelAndView ;
    }
}

Flight class

        @Entity
        @Table(name = "flights")
        public class Flight {
        
            @Id
            @GeneratedValue(strategy=GenerationType.IDENTITY)
            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")
            @Temporal(TemporalType.DATE)
            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) {
        this.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

update

error stack : https://pastebin.com/hT6b3WEX

Answer

You have written listvalue with upper V and lower v



Source: stackoverflow