I have template html file which look like this
<!DOCTYPE html>
<html lang="en">
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>
<h2>Email Report: Crash in Log File</h2>
<table style="width:100%">
<tr>
<th>Device Mode</th>
<th>IP</th>
<th>Platform</th>
<th>Host Name</th>
<th>Test</th>
<th>Time</th>
</tr>
<tr>
<td id="dm"></td>
<td id="ip"></td>
<td id="pla"></td>
<td id="hn"></td>
<td id="test"></td>
<td id="time"></td>
</tr>
</table>
<br>
<br>
<br>
<table style="width:100%">
<tr>
<th>Stack Trace</th>
</tr>
<tr>
<td id="st"></td>
</tr>
</table>
</body>
</html>
I have in my java porgram variables like ip, deviceName and etc and i want to insert these variables to the table
for exsample insert the ip var to <td id="ip"></td>
how can I do it ?
CodePudding user response:
You can not bind a Java object to HTML directly. You have to use JSP rather than using plain HTML page.
CodePudding user response:
You can use Apache FreeMarker here. https://www.vogella.com/tutorials/FreeMarker/article.html