GWT xml看起来像:
$(document).ready(function() {
$('#carl-dair').load fadeIn("slow");
});
我怎样才能在Java代码中获得这两个参数?与下面的代码类似:
<my:CustomWidget>
<my:tag para1="a" para2="b"/>
</my:CustomWidget>
PS:上面的Java代码不起作用。
在GWT中使用UiChild标记还有其他方法可以获取参数吗?
答案 0 :(得分:0)
您应该@UiChild
级CustomWidget
:
class MyCustomWidget extends Composite {
@UiChild(tagname = "tag")
public void addTag(Tag tag) {
/* ... */
}
}
以及构造函数的Tag
类中的参数,用@UiConstructor
注释:
class Tag extends Composite {
@UiConstructor
public Tag(String para1, String para2) {
/* ... */
}
}