BeanEditFormコンポーネントの使用方法を理解するのに少し問題があります。 私はBeanクラスのためにパラメータ化されたコンストラクタを使用していない限り、それがあれば何でも構いません。これは私のBeanクラスがどのように見えるかです:Tapestry 5 BeanEditFormコンポーネントの問題
public class Celebrity {
private String firstName;
private String lastName;
private long ID;
private Date dateOfBirth;
private Occupation occupation;
private String biography;
private boolean birthDateVerified;
public Celebrity() {
}
public Celebrity(String firstName, String lastName, Date dateOfBirth, Occupation occupation, String biography, boolean birthDateVerified) {
this.firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.occupation = occupation;
this.biography = biography;
this.birthDateVerified = birthDateVerified;
}
public Celebrity(String firstName, String lastName, Date dateOfBirth, Occupation occupation) {
this.firstName = firstName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.occupation = occupation;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public long getID() {
return ID;
}
public void setID(long ID) {
this.ID = ID;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public Occupation getOccupation() {
return occupation;
}
public void setOccupation(Occupation occupation) {
this.occupation = occupation;
}
/**
* @return the biography
*/
public String getBiography() {
return biography;
}
public void setBiography(String biography) {
this.biography = biography;
}
public boolean getBirthDateVerified() {
return birthDateVerified;
}
public void setBirthDateVerified(boolean birthDateVerified) {
this.birthDateVerified = birthDateVerified;
}
}
これは私のタペストリーテンプレートです:AddNewCelebrity.tml
<html t:type="layout" title="Celebrity Details"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
xmlns:p="tapestry:parameter">
<head>
<Title>Adding new celebrety</Title>
</head>
<body>
<t:beaneditform t:id="celebrity"/>
</body>
</html>
とそのJavaクラス:
public class AddNewCelebrity {
@Persist
private Celebrity celebrity;
public Celebrity getCelebrity() {
return celebrity;
}
public void setCelebrity(Celebrity celeb) {
this.celebrity = celeb;
}
}
これは私のエラーですパラメータ化されたコンストラクタについてコメントしていないときは、タペストリーから取得してください:
はSetupRenderキューエラーをレンダリング[AddNewCelebrity:celebrity.editor]:例外(コンポーネントの 'AddNewCelebrity:celebrity.editorを'):com.celebreties.celebs.model.Celebrityのインスタンスをインスタンス化エラーコンストラクタcom.celebreties.celebs.modelを呼び出します。 Celebrity(String、String、Date、Occupation、String、boolean)(Celebrity.java:29で)(サービス 'BeanModelSource'の場合):サービスはjava.lang.Stringインタフェースを実装していません。
私は、Tomcat 6.0.32
とタペストリー5.2.4を使用しています、私は何を行うことができますいくつかのガイドラインを与えてください。
Martinさん、ありがとう、これは私の問題を完全に解決しました。私はBeanEditFormのモデルコンポーネントとして挿入できる何らかの種類のモデルクラスを探し求めていました。そのような時間の無駄ではなかったが、これはよりエレガントなソリューションです。 –