String s=
"<html>
<head>
<title>app</title>
</head>
<body bgcolor="pink">
<div align="center"><img src="" width="900" height="100"/>
</div>
<h2 align="center">Welcome to your rewards program</h2>
<table>
<tr>
<td><p> You now have ongoing uninterrupted access to thousands of discounts all on your phone .Accessing great savings just got so easier . You can search by category , by keyword and also search local with what around me. Select a merchant offer you like and present the coupon on your phone at the time of settling your bill . Some merchants only offer their services online and you will also be able to click through to their online offerings .
GIN image</p></td>
</tr>
</table>
</body>
</html>";
我想將html數據添加到字符串,但它給了我錯誤。我該如何解決這個問題? 我使用了escapse序列,但它沒有奏效。如何用雙引號將HTML數據添加到java中的字符串?
感謝
可以從Apache使用[StringEscapeUtils(http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/StringEscapeUtils.html)? – NINCOMPOOP
你不能在java中打開多行字符串。你必須用+連接它們,然後跳過「當然 –