Javascript 如何使用Thymeleaf在字符串段落中创建超链接(<;a>;<;/a>;)
我有一段字符串,其中也包含URL单词, 比如: “你好,世界,和 欢迎你。” 生成PDF时,这两个URL单词应作为超链接出现,其余文本应为纯文本Javascript 如何使用Thymeleaf在字符串段落中创建超链接(<;a>;<;/a>;),javascript,jquery,html,spring,thymeleaf,Javascript,Jquery,Html,Spring,Thymeleaf,我有一段字符串,其中也包含URL单词, 比如: “你好,世界,和 欢迎你。” 生成PDF时,这两个URL单词应作为超链接出现,其余文本应为纯文本 @modeldattribute(“paragrah”) @ModelAttribute("paragrah") public String getParagraph() { return "Hello world, <a href='http://thymeleaf.org'>http://thymeleaf.org</a&
@modeldattribute(“paragrah”)
@ModelAttribute("paragrah")
public String getParagraph()
{
return "Hello world, <a href='http://thymeleaf.org'>http://thymeleaf.org</a> and <a href='https://google.com'>https://google.com</a> welcomes you.";
}
公共字符串get段落()
{
返回“你好,世界,欢迎您。”;
}
HTML
<p th:text="${paragraph}"/>