You end up with syntactically invalid HTML this way:
<html>
<head></head>
<body>
<head></head>
<body>...</body>
</body>
</html>
This is not right. There can be only one <head>
and <body>
. The browsers will behave unspecified. You need to remove the entire <head>
and the wrapping <body>
from that HTML so that you end up with only
<FONT color=#000000 size=2 face="Segoe UI">l?uft nicht</FONT>
You'd need to either update the DB to remove unnecessary HTML, or to use Jsoup to parse this piece out on a per-request basis something like as follows:
String bodyContent = Jsoup.parse(htmlFromDB).body().html();
// ...
Alternatively, you could also display it inside a HTML <iframe>
instead with help of a servlet. E.g.
<iframe src="htmlFromDBServlet?id=123"></iframe>
Unrelated to the concrete problem:
- Storing HTML in a DB is a terrible design.
- If the HTML originates from user-controlled input, you've a huge XSS attack hole this way.
- The
<font>
tag is deprecated since 1998.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…