I upload HTML file into DB as byte[] in blob column, and in another part I have to retrieve this file and display in textarea, I'm able to retrieve from DB as bytes and convert it into string, but when display its shows as encrypt format.
This is the struts application:
This is my jsp:
<tr>
<td colspan="3" class="searchinput">
<html:textarea property="template" cols="100" rows="10" name="sendEmailForm">
</html:textarea>
</td>
</tr>
This is my form bean:
private String template = null;
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
}
This is my bean:
private byte[] templateContent = null;
public String getHtmlTemplateContent() {
return templateContent.toString();
}
public byte[] getTemplateContent() {
return templateContent;
}
public void setTemplateContent(byte[] templateContent) {
this.templateContent = templateContent;
}
public void setTemplateContent(Object templateContent) {
this.templateContent = (byte[])templateContent;
}
This is my action:
templatesDataBean = (TemplatesDataBean)SendEmailManager.getTemplate(action, actor, sendEmailBean);
sendEmailForm.setTemplate(new String(templatesDataBean.getHtmlTemplateContent()));
How can this can be solved? Thanks in advance.