我想用tapestry5创建一个子表单:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
<t:TextField t:id="name" />
</html>
并像这样使用它:
<form t:type="form" t:id="testForm">
<t:testComponent name="name" />
<input type="submit"/>
</form>
测试组件.java:
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
public class TestComponent {
@Parameter(required = true, allowNull = false)
@Property
private String name;
}
这样我就可以使用“名称”的值,例如:
@Property
private String name;
void onSuccessFromTestForm() {
System.out.println(name);
}
但我得到的只是一个应用程序异常:
Render queue error in BeginRender[Index:testcomponent.name]: Failure reading parameter 'value' of component Index:testcomponent.name: Parameter 'name' of component Index:testcomponent is bound to null. This parameter is not allowed to be null.
有什么问题?