我正在尝试在具有以下字段的表订单中插入数据:id PK、cid FK、pid FK、
我正在尝试在此订单 bean 中插入数据。
这是我的 JSP 代码:
<form:form>
<form:hidden path="id"/>
<table cellpadding="2px">
<tr><td><label>Customer ID</label></td><td><form:input path="cid"/><form:errors path="cid" /></td></tr>
<tr><td><label>Package ID</label></td><td><form:input path="pid"/><form:errors path="pid" /></td></tr>
<tr align="center"><td colspan="2"><input type="submit" value="Save Changes" /></td></tr>
</table>
</form:form>
这是控制器代码:
@RequestMapping(value="/editorder", method=RequestMethod.GET)
public String EditPerson(Model model){
model.addAttribute("command", new Order());
return "/WEB-INF/pages/orders/editorder.jsp";
}
我收到错误:(我在这里只提到了根本原因)
根本原因org.springframework.beans.NotReadablePropertyException:bean类[com.order.domain.Order]的无效属性'cid':Bean属性'cid'不可读或具有无效的getter方法:getter的返回类型是否匹配setter的参数类型?
请问有什么解决办法吗?
Here is Order bean:
package com.order.domain;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="orders")
public class Order extends BaseEntity{
@ManyToOne
@JoinColumn(name="cid")
private Customer customer;
@ManyToOne
@JoinColumn(name="pid")
private Packagee package1;
@OneToMany(mappedBy="order")
private List<Feedback> feedbacks;
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Packagee getPackage1() {
return package1;
}
public void setPackage1(Packagee package1) {
this.package1 = package1;
}
public List<Feedback> getFeedbacks() {
return feedbacks;
}
public void setFeedbacks(List<Feedback> feedbacks) {
this.feedbacks = feedbacks;
}
}