Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将HTML标记与Java字符串一起添加?_Java_Html_String_Tags - Fatal编程技术网

如何将HTML标记与Java字符串一起添加?

如何将HTML标记与Java字符串一起添加?,java,html,string,tags,Java,Html,String,Tags,我有一个java字符串,我需要将其显示在邮件正文中。在这个消息之后,我想添加一个HTML按钮。我该怎么做 我的字符串: String customerMessage = "Hi, We have received your request. Your account will be unblocked within 48 hours. 我想添加的是在两行中断之后: <a href="http://www.google.com" target="_parent"> <but

我有一个java
字符串
,我需要将其显示在邮件正文中。在这个消息之后,我想添加一个HTML按钮。我该怎么做

我的字符串:

String customerMessage = "Hi, We have received your request. Your account will be unblocked within 48 hours.
我想添加的是在两行中断之后:

<a href="http://www.google.com" target="_parent">
  <button>Click me !</button>
</a>

您需要将HTML代码编写为字符串,并在字符串中添加

,以便中断。比如:

StringBuilder sb = new StringBuilder();
sb.append("Hi, We have received your request. Your account will be unblocked within 48 hours.");
sb.append("<br><br><a href=\"http://www.google.com\" target=\"_blank\"><button>Click me !</button></a>");
StringBuilder sb=新建StringBuilder();
sb.append(“您好,我们已收到您的请求。您的帐户将在48小时内解锁。”);
sb.追加(“

”);
开发使用哪个框架…?您必须将HTML代码编写为
字符串。。。如果要在HTML中使用换行符,请在HTML字符串的末尾添加