如何在GWT中传递UiChild标记中的多个参数?
GWT xml看起来像:如何在GWT中传递UiChild标记中的多个参数?,gwt,Gwt,GWT xml看起来像: <my:CustomWidget> <my:tag para1="a" para2="b"/> </my:CustomWidget> PS:上面的Java代码不起作用 通过在GWT中使用UiChild标记获取参数还有其他方法吗?您应该在CustomWidget级别拥有@UiChild: class MyCustomWidget extends Composite { @UiChild(tagname = "tag")
<my:CustomWidget>
<my:tag para1="a" para2="b"/>
</my:CustomWidget>
PS:上面的Java代码不起作用
通过在GWT中使用UiChild标记获取参数还有其他方法吗?您应该在
CustomWidget
级别拥有@UiChild
:
class MyCustomWidget extends Composite {
@UiChild(tagname = "tag")
public void addTag(Tag tag) {
/* ... */
}
}
以及构造函数的标记
类中的参数,用@UiConstructor
注释:
class Tag extends Composite {
@UiConstructor
public Tag(String para1, String para2) {
/* ... */
}
}
您应该在
CustomWidget
级别拥有@UiChild
:
class MyCustomWidget extends Composite {
@UiChild(tagname = "tag")
public void addTag(Tag tag) {
/* ... */
}
}
以及构造函数的标记
类中的参数,用@UiConstructor
注释:
class Tag extends Composite {
@UiConstructor
public Tag(String para1, String para2) {
/* ... */
}
}