Java 如何使用对象修复Spring引导中的错误?

Java 如何使用对象修复Spring引导中的错误?,java,spring,spring-boot,thymeleaf,Java,Spring,Spring Boot,Thymeleaf,我正在尝试创建一个表单来捕获用户数据。但是,当我运行应用程序时,它会向我抛出一个错误,即在我的html中,input标记中有一个错误。我确保使用我的类中的所有变量,但它仍然不起作用。下面是代码 Home.html: <form action="#" th:action="@{/User-tyler}" th:object="${avsApp}" method="POST"> <div class="col-md-8">

我正在尝试创建一个表单来捕获用户数据。但是,当我运行应用程序时,它会向我抛出一个错误,即在我的html中,
input
标记中有一个错误。我确保使用我的类中的所有变量,但它仍然不起作用。下面是代码

Home.html:

 <form action="#" th:action="@{/User-tyler}" th:object="${avsApp}" method="POST">
            <div class="col-md-8">
                <div class="filter-search">
                    <input type="text" class="form-control" id="myInput" th:field="*{mAppCode}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAcronym}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAppName}"  placeholder="Search.."/>


                    <div class="list-group" id="myList">
                        <div th:each="ary2 : ${ary2}">
                            <a href="#" class="list-group-item list-group-item-action dataObj" th:text="${ary2.mAppName}" th:value="${ary2.mAppCode}"></a>
                        </div>
                    </div> 
                </div>
            </div>

            <div class="col-md-4">
                    <span class="input-group-btn">
                      <button type="submit" class="btn btn-primary eBtn">View</button>  
                    </span>
            </div>
            </form>
import javax.persistence.*;

@Entity
@Table(name = "avs")
public class AVSApplication {

    @Id
    @Column(name = "appcode")
    private String mAppCode;

    @Column(name = "acro")
    private String mAcronym;

    @Column(name = "appname")
    private String mAppName;


    //Constructor
    public AVSApplication(String mAppCode, String mAcronym, String mAppName) {
        super();
        this.mAppCode = mAppCode;
        this.mAcronym = mAcronym;
        this.mAppName = mAppName;
    }


    //Default Constructor
    public AVSApplication () {

    }


    //Getters
    public String getmAppCode() {
        return mAppCode;
    }

    public String getmAcronym() {
        return mAcronym;
    }
    public String getmAppName() {
        return mAppName;
    }



    //Setters
    public void setmAcronym(String mAcronym) {
        this.mAcronym = mAcronym;
    }

    public void setmAppCode(String mAppCode) {
        this.mAppCode = mAppCode;
    }

    public void setmAppName(String mAppName) {
        this.mAppName = mAppName;
    }




}

        @RequestMapping("/User-tyler")
        public String processForm(AVSApplication avsApp) {

            return "tier";
        }
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Oct 07 08:58:51 EDT 2019
There was an unexpected error (type=Internal Server Error, status=500).
Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "home" - line 54, col 59)
控制器:

 <form action="#" th:action="@{/User-tyler}" th:object="${avsApp}" method="POST">
            <div class="col-md-8">
                <div class="filter-search">
                    <input type="text" class="form-control" id="myInput" th:field="*{mAppCode}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAcronym}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAppName}"  placeholder="Search.."/>


                    <div class="list-group" id="myList">
                        <div th:each="ary2 : ${ary2}">
                            <a href="#" class="list-group-item list-group-item-action dataObj" th:text="${ary2.mAppName}" th:value="${ary2.mAppCode}"></a>
                        </div>
                    </div> 
                </div>
            </div>

            <div class="col-md-4">
                    <span class="input-group-btn">
                      <button type="submit" class="btn btn-primary eBtn">View</button>  
                    </span>
            </div>
            </form>
import javax.persistence.*;

@Entity
@Table(name = "avs")
public class AVSApplication {

    @Id
    @Column(name = "appcode")
    private String mAppCode;

    @Column(name = "acro")
    private String mAcronym;

    @Column(name = "appname")
    private String mAppName;


    //Constructor
    public AVSApplication(String mAppCode, String mAcronym, String mAppName) {
        super();
        this.mAppCode = mAppCode;
        this.mAcronym = mAcronym;
        this.mAppName = mAppName;
    }


    //Default Constructor
    public AVSApplication () {

    }


    //Getters
    public String getmAppCode() {
        return mAppCode;
    }

    public String getmAcronym() {
        return mAcronym;
    }
    public String getmAppName() {
        return mAppName;
    }



    //Setters
    public void setmAcronym(String mAcronym) {
        this.mAcronym = mAcronym;
    }

    public void setmAppCode(String mAppCode) {
        this.mAppCode = mAppCode;
    }

    public void setmAppName(String mAppName) {
        this.mAppName = mAppName;
    }




}

        @RequestMapping("/User-tyler")
        public String processForm(AVSApplication avsApp) {

            return "tier";
        }
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Oct 07 08:58:51 EDT 2019
There was an unexpected error (type=Internal Server Error, status=500).
Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "home" - line 54, col 59)
错误:

 <form action="#" th:action="@{/User-tyler}" th:object="${avsApp}" method="POST">
            <div class="col-md-8">
                <div class="filter-search">
                    <input type="text" class="form-control" id="myInput" th:field="*{mAppCode}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAcronym}"  placeholder="Search.."/>
<input type="text" class="form-control" id="myInput" th:field="*{mAppName}"  placeholder="Search.."/>


                    <div class="list-group" id="myList">
                        <div th:each="ary2 : ${ary2}">
                            <a href="#" class="list-group-item list-group-item-action dataObj" th:text="${ary2.mAppName}" th:value="${ary2.mAppCode}"></a>
                        </div>
                    </div> 
                </div>
            </div>

            <div class="col-md-4">
                    <span class="input-group-btn">
                      <button type="submit" class="btn btn-primary eBtn">View</button>  
                    </span>
            </div>
            </form>
import javax.persistence.*;

@Entity
@Table(name = "avs")
public class AVSApplication {

    @Id
    @Column(name = "appcode")
    private String mAppCode;

    @Column(name = "acro")
    private String mAcronym;

    @Column(name = "appname")
    private String mAppName;


    //Constructor
    public AVSApplication(String mAppCode, String mAcronym, String mAppName) {
        super();
        this.mAppCode = mAppCode;
        this.mAcronym = mAcronym;
        this.mAppName = mAppName;
    }


    //Default Constructor
    public AVSApplication () {

    }


    //Getters
    public String getmAppCode() {
        return mAppCode;
    }

    public String getmAcronym() {
        return mAcronym;
    }
    public String getmAppName() {
        return mAppName;
    }



    //Setters
    public void setmAcronym(String mAcronym) {
        this.mAcronym = mAcronym;
    }

    public void setmAppCode(String mAppCode) {
        this.mAppCode = mAppCode;
    }

    public void setmAppName(String mAppName) {
        this.mAppName = mAppName;
    }




}

        @RequestMapping("/User-tyler")
        public String processForm(AVSApplication avsApp) {

            return "tier";
        }
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Oct 07 08:58:51 EDT 2019
There was an unexpected error (type=Internal Server Error, status=500).
Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "home" - line 54, col 59)

首先,您有3个id相同的输入。erorr会准确地告诉您它阻塞了哪一行,我们无法知道哪一行是。@M.Deinum是第一个
输入
字段。即使当我更改输入
id
时,它仍然显示相同的错误。我猜错误/问题是您的字段名,或者更好的是您的getter/setter。使用
getMAppCode
或完全放弃
m
的前缀(不确定应该添加什么)。