Issue
I want to put this which worked in a jsp file into a PrintWriter.
From:
<td><img src="data:image/jpg;base64,${al.base64Image}" width="240" height="300"/></td>
To:
out.print("<td>" +"<img src=data:image/jpg;base64," + al.getBase64Image()+ "width='240' height='300'/></td>");
Solution
When you are writing out the markup you need to wrap the base64 encoded src attribute in a either a '
or a "
(Which would be inserted into you string as an escaped quote \"
). Also note that you are missing a space before the width property.
out.print("<td><img src='data:image/jpg;base64," + al.getBase64Image()+ "' width='240' height='300'/></td>");
You can always test the validity of your markup using the W3C Markup Validator
Answered By - pfranza
Answer Checked By - Robin (JavaFixing Admin)