Spring boot EL1008E:属性或字段';i可用';在类型为';com.inventory.domain.Item';-可能不是公开的或无效的?
我在item bean中有一个布尔字段,所有其他字段都在填充,但只有isAvailable未使用thymeleaf在ui中填充我遇到错误,因为找不到Spring boot EL1008E:属性或字段';i可用';在类型为';com.inventory.domain.Item';-可能不是公开的或无效的?,spring-boot,thymeleaf,spring-el,Spring Boot,Thymeleaf,Spring El,我在item bean中有一个布尔字段,所有其他字段都在填充,但只有isAvailable未使用thymeleaf在ui中填充我遇到错误,因为找不到属性我没有找到根本原因 在thymeleaf中是否有读取布尔字段的特定方法。因为在.html页面中,当我试图读取布尔值st.isAvailable时,它在后端属性中的抛出错误找不到,因此没有填充值 项目Bean package com.inventory.domain; import java.math.BigDecimal; import jav
属性
我没有找到根本原因
在thymeleaf中是否有读取布尔字段的特定方法。因为在.html页面中,当我试图读取布尔值st.isAvailable时,它在后端属性中的抛出错误找不到,因此没有填充值
项目Bean
package com.inventory.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
@Entity
@Table(name = "item")
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int item_id;
@ManyToOne
@JoinColumn(name = "category_id")
private Category categoryId;
@Column(name = "item_name",unique = true)
private String itemName;
@Column(name = "current_stock_quantity")
private double currentStockQuantity;
public double getCurrentStockQuantity() {
return currentStockQuantity;
}
@Column(name = "unit")
@Enumerated(EnumType.STRING)
private ItemWeightUnit unit;
@Column(name = "current_purchase_price")
private double currentPurchasePrice;
@Column(name = "is_available")
private boolean isAvailable;
@Column(name = "is_active")
private boolean isActive;
@Column(name = "item_description")
@Lob
private String itemDescription;
@OneToMany(mappedBy = "item",cascade = CascadeType.ALL)
private List<Vendor> vendor = new ArrayList<Vendor>();
@OneToMany(mappedBy = "item",cascade = CascadeType.ALL)
@OrderBy("transaction_date ASC")
private SortedSet<ItemTransaction> itemTransaction=new TreeSet<ItemTransaction>();
@OneToMany(mappedBy = "item",cascade = CascadeType.ALL)
@OrderBy("date ASC")
private SortedSet<PricingHistory> priceHistory=new TreeSet<PricingHistory>();
public SortedSet<ItemTransaction> getItemTransaction() {
return itemTransaction;
}
public void setItemTransaction(SortedSet<ItemTransaction> itemTransaction) {
this.itemTransaction = itemTransaction;
}
public void setCurrentStockQuantity(double currentStockQuantity) {
this.currentStockQuantity = currentStockQuantity;
}
public List<Vendor> getVendor() {
return vendor;
}
public void setVendor(List<Vendor> vendor) {
this.vendor = vendor;
}
public int getItem_id() {
return item_id;
}
public void setItem_id(int item_id) {
this.item_id = item_id;
}
public Category getCategoryId() {
return categoryId;
}
public void setCategoryId(Category categoryId) {
this.categoryId = categoryId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public boolean isAvailable() {
return isAvailable;
}
public void setAvailable(boolean isAvailable) {
this.isAvailable = isAvailable;
}
public boolean isActive() {
return isActive;
}
public void setActive(boolean isActive) {
this.isActive = isActive;
}
public ItemWeightUnit getUnit() {
return unit;
}
public void setUnit(ItemWeightUnit unit) {
this.unit = unit;
}
public double getCurrentPurchasePrice() {
return currentPurchasePrice;
}
public void setCurrentPurchasePrice(double currentPurchasePrice) {
this.currentPurchasePrice = currentPurchasePrice;
}
public SortedSet<PricingHistory> getPriceHistory() {
return priceHistory;
}
public void setPriceHistory(SortedSet<PricingHistory> priceHistory) {
this.priceHistory = priceHistory;
}
}
<tbody>
<tr th:each="st,iter : ${items}">
<td th:text="${iter.count}"></td>
<td th:text="${st.itemName}"></td>
<td th:text="${st.currentStockQuantity}"></td>
<td th:text="${st.unit}"></td>
<td th:text="${st.currentPurchasePrice}"></td>
<div th:if="${st.isAvailable} == true">
<td>Yes</td>
</div>
<div th:unless="${st.isAvailable} == false">
<td>No</td>
</div>
<td>
<a href="#" class="btn btn-default" th:href="@{/karyawan/form(id=${st.id})}"
title="Edit Data"><span class="glyphicon glyphicon-edit"></span></a>
<a href="#" class="btn btn-default" th:href="@{/karyawan/delete(id=${st.id})}"
title="Delete Data"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
<tr th:if="${#lists.isEmpty(items.content)}">
<td colspan="13" class="text-center">Data Not Found</td>
</tr>
</tbody>
package com.inventory.domain;
导入java.math.BigDecimal;
导入java.util.ArrayList;
导入java.util.HashSet;
导入java.util.LinkedHashSet;
导入java.util.List;
导入java.util.Set;
导入java.util.SortedSet;
导入java.util.TreeSet;
导入javax.persistence.CascadeType;
导入javax.persistence.Column;
导入javax.persistence.Entity;
导入javax.persistence.EnumType;
导入javax.persistence.Enumerated;
导入javax.persistence.GeneratedValue;
导入javax.persistence.GenerationType;
导入javax.persistence.Id;
导入javax.persistence.JoinColumn;
导入javax.persistence.Lob;
导入javax.persistence.manytone;
导入javax.persistence.OneToMany;
导入javax.persistence.OrderBy;
导入javax.persistence.Table;
@实体
@表(name=“item”)
公共类项目{
@身份证
@GeneratedValue(策略=GenerationType.AUTO)
私有int项_id;
@许多酮
@JoinColumn(name=“category\u id”)
私有范畴范畴;
@列(name=“item\u name”,unique=true)
私有字符串itemName;
@列(name=“当前库存数量”)
私人股本数量;
公共双getCurrentStockQuantity(){
退货数量;
}
@列(name=“unit”)
@枚举(EnumType.STRING)
私营部门;
@列(name=“当前采购价格”)
私人双电流购买价格;
@列(name=“是否可用”)
私有布尔值不可用;
@列(name=“处于活动状态”)
私有布尔非活动;
@列(名称=“项目描述”)
@高球
私有字符串项描述;
@OneToMany(mappedBy=“item”,cascade=CascadeType.ALL)
私有列表供应商=新的ArrayList();
@OneToMany(mappedBy=“item”,cascade=CascadeType.ALL)
@订购人(“交易日ASC”)
private SortedSet itemTransaction=新树集();
@OneToMany(mappedBy=“item”,cascade=CascadeType.ALL)
@订购人(“日期ASC”)
private SortedSet priceHistory=新树集();
公共SortedSet getItemTransaction(){
退货交易;
}
公共作废setItemTransaction(SortedSet itemTransaction){
this.itemTransaction=itemTransaction;
}
公共无效设置currentStockQuantity(双倍currentStockQuantity){
this.currentStockQuantity=currentStockQuantity;
}
公共列表getVendor(){
退货供应商;
}
公共供应商(列出供应商){
this.vendor=供应商;
}
public int getItem_id(){
退货项目标识;
}
公共无效setItem_id(int item_id){
this.item\u id=item\u id;
}
公共类别getCategoryId(){
返回类别ID;
}
公共无效集合类别ID(类别类别ID){
this.categoryId=categoryId;
}
公共字符串getItemName(){
返回itemName;
}
public void setItemName(字符串itemName){
this.itemName=itemName;
}
公共字符串getItemDescription(){
退货项目描述;
}
公共void setItemDescription(字符串itemDescription){
this.itemsdescription=itemsdescription;
}
公共布尔值isAvailable(){
可获得的回报;
}
public void setAvailable(布尔值isAvailable){
this.isAvailable=isAvailable;
}
公共布尔isActive(){
回报是积极的;
}
public void setActive(布尔值isActive){
this.isActive=isActive;
}
public ItemWeightUnit getUnit(){
返回单元;
}
公共无效集合单位(ItemWeightUnit){
这个。单位=单位;
}
公共双getCurrentPurchasePrice(){
返回当前购买价格;
}
公共作废setCurrentPurchasePrice(双倍currentPurchasePrice){
this.currentPurchasePrice=currentPurchasePrice;
}
公共分类数据集getPriceHistory(){
返回历史;
}
公共无效setPriceHistory(SortedSet priceHistory){
this.priceHistory=priceHistory;
}
}
对
不
找不到数据
Getter
和Setter
forisAvailable
方法不正确,反序列化和序列化时需要更新它们
public boolean getIsAvailable() {
return isAvailable;
}
public void setIsAvailable(boolean isAvailable) {
this.isAvailable = isAvailable;
}