-6ren">
gpt4 book ai didi

java - vaadin clara 中的内部 html

转载 作者:行者123 更新时间:2023-12-01 12:19:40 25 4
gpt4 key购买 nike

我正在使用 vaadin clara 来构建 UI。
1.当我使用这种结构时:

<?xml version="1.0" encoding="UTF-8"?>
<VerticalLayout xmlns="urn:import:com.vaadin.ui" xmlns:p="urn:vaadin:parent" defaultComponentAlignment="MIDDLE_CENTER">
<Label caption=<![CDATA[<b>Register</b>]]> contentMode="HTML" width=""></Label>
<Form>
<TextField id="name" caption="Name"></TextField>
<TextField id="login" caption="E-mail"></TextField>
<PasswordField id="password" caption="Pass"></PasswordField>
<PasswordField id="password-check" caption="Pass check"></PasswordField>
</Form>
<HorizontalLayout>
<Button id="register-button" caption="Register"></Button>
<Button id="login-button" caption="Login"></Button>
</HorizontalLayout>
</VerticalLayout>

我有错误:

HTTP Status 500 - com.vaadin.server.ServiceException: org.vaadin.teemu.clara.inflater.LayoutInflaterException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 18; Open quote is expected for attribute "{1}" associated with an element type "caption".


2.如果我使用这样的构造:

...
<Label caption="<b>Register</b>" contentMode="HTML" width=""></Label>
...

我有错误:

HTTP Status 500 - com.vaadin.server.ServiceException: org.vaadin.teemu.clara.inflater.LayoutInflaterException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 19; The value of attribute "caption" associated with an element type "null" must not contain the '<' character.<br>


3.如果我使用没有内部html的标签,代码可以正常工作。

...
<Label caption="Register" contentMode="HTML" width=""></Label>
...

我的问题是如何在 vaadin clara 框架中使用内部 html。谢谢。

最佳答案

您必须引用/转义 HTML。在您的情况下,它将是:Register。 XML 必须有效。一个好的编辑器或 IDE 会警告您这一点,甚至可以为您转义。

关于java - vaadin clara 中的内部 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26787173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com