如何在java文件中使用html:label
如何在java文件中使用html:label?
比如说,我想从我的 java 文件中生成以下内容:
<html:label> test label </html:label>
我尝试了以下方法:
import org.zkoss.zul.Html;
public class TestLabel {
private Label testLabel;
TestLabel() {
testLabel.setTextContent("test label");
}
}
这会引发错误,因为标签没有 setTextContent 这样的方法。我应该使用哪种方法来实现这一目标?
谢谢, 索尼
How do I use html:label in java file?
Say, I want to produce the following from my java file:
<html:label> test label </html:label>
I tried this:
import org.zkoss.zul.Html;
public class TestLabel {
private Label testLabel;
TestLabel() {
testLabel.setTextContent("test label");
}
}
This throws an error as there is no such method as setTextContent for a label. Which method do I use to achieve this?
Thanks,
Sony
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
setValue(字符串值)?
http://www .zkoss.org/javadoc/3.6/zk/org/zkoss/zul/Label.html#setValue(java.lang.String)
setValue(String value)?
http://www.zkoss.org/javadoc/3.6/zk/org/zkoss/zul/Label.html#setValue(java.lang.String)
我使用的是 Zhtml 标签而不是常规的 Html 标签。所以,我所做的就是向 Zhtml Label 添加一个常规的 Html 子元素。意思是,
上面只是一个小测试用例。但是,这样做的最初目的是将 Zhtml 标签的 id 发送到 java 文件,并在满足特定条件时对 zhtml 标签执行操作。接下来,客户端执行其他操作,例如当此 zhtml 标签更改时清除缓存。
I am using a Zhtml Label rather than a regular Html Label. So, what I did is I added a regular Html child to Zhtml Label. Meaning,
The above is just a small test case. But, originally the purpose of doing this is to send the id of a Zhtml label to the java file and perform operations on zhtml label when a particular condition is met. Next, the client performs other operations such as clearing a cache when this zhtml label changes.