一直在使用j2html从 Java 创建 html,运行良好,但是当我想要这样的东西时,我不明白如何使用
<p>The fox ran over the <b>Bridge</b> in the forest</p>
如果我做
import static j2html.TagCreator.*;
public class HtmlTest
{
public static void main(String[] args)
{
System.out.println(p("The fox ran over the " + b(" the bridge") + "in the forest"));
}
}
我明白了
<p>The fox ran over the <b>the bridge</b> in the forest</p>
即它将粗体视为文本。
注意只是做
import static j2html.TagCreator.*;
public class HtmlTest
{
public static void main(String[] args)
{
System.out.println(p(b("the bridge")));
}
}
确实呈现正确
<p><b>the bridge</b></p>