th:field not working?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

th:field not working?

Maxx
Hello i have been stuck trying to use thymeleaf for making a post request of a form but for some reason specifically th:field is not working ( i did try and error to narrow the problem down. ) i have looked up online but i cant really see the issue i am having.

here is some code.

 public class DepositeMoneyBean {
       
        private Integer transaction_id;
        private Integer transaction_user_id;
        private String transaction_type;
        private String amount;
        private Date transaction_date;
        private Integer credit_id;
        private Integer end_user_money;
        private Double current_amount;
this includes getters, setters, toString, and contructors.

html
  <div class="container">
                                        <form action="#" th:action="@{/makeadeposit}" th:object="${depositeMoneyBean}"
                                                method="post">
                                                <p>
                                                        Id: <input type="text" th:field="*{amount}" />
                                                </p>
                                                <p>
                                                        <input type="submit" value="Submit" />
                                                </p>
                                        </form>
                                </div>


and Controller

@PostMapping("/makeadeposit")
        public String makeADeposite(@ModelAttribute DepositeMoneyBean depositeMoneyBean) {
       
               
                return "redirect:/";
        }

any idea why this is happening? thx in advance


Reply | Threaded
Open this post in threaded view
|

Re: th:field not working?

Reiju
fields naming with underscore...