include html content in jsp
Hi ,
I have the html data and need to include in the jsp .
eg :
String htmldata = " <html><body>testdata </body></html>";
how can i display this htmldata in the jsp . I mean I need this data in html format ( testdata ) and should not see all html tags in the explorer.
Suggest me if you know anything.
Thanks in advance.
- bregoty
[405 byte] By [
bregotya] at [2007-11-27 9:48:05]

# 3
I shouldn't use the path .. because path is always and restricted one. So i couldn't able to use the jsp:include tag to include html file.
The data is coming from the Event hander which retrieves from the databean.
I am getting the value like this ...
<table width=100% cellspacing=0 cellpadding=5>
<c:forEach items="${myBean}" var="myDB">
<tr height=10px> <td>
<c:out value="${myDB.htmldata}"/>
</td></tr>
</table>
I don't know whether it is parsing problem or some other thing.
Thanks,
bregoty
# 4
You have the right idea, but you need to specify the escapeXml attribute on the c:out tag to be false. It defaults to true, and this means that when c:out encounters special characters it tries to display as-is rather, which is why you saw your HTML formatting. Set the escapeXml attribute to false and this should solve your problem.
<table width=100% cellspacing=0 cellpadding=5>
<c:forEach items="${myBean}" var="myDB">
<tr height=10px>
<td>
<c:out value="${myDB.htmldata}" escapeXml="false" />
</td>
</tr>
</table>