到HTML中使用j2html去过创建Java的HTML,工作很好,但我不明白如何时,我想是这样的如何呈现文本包含HTML与j2html java的LIB
<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>
大,三江源 –