我正在尝试创建一个表单来捕获用户数据。但是,当我运行该应用程序时,它抛出一个错误,说在我的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>
AVSApplication类:
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;
}
}
Controller:
@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)
如果返回“层”,则应在tier.html
文件夹中显示一个templates
。如果您不这样做,它将找不到要显示的任何页面,它将返回该错误。