0
I need the following routine to be done:
- Read some information from the database;
- Generate a csv based on this data;
- Write this csv to the database;
- Start downloading this file to the user.
I was able to do items 1 and 2, generating the file as follows:
FileWriter writer = new FileWriter("c:\\test.csv");
writer.append("user");
writer.flush();
writer.close();
Going to item 3. I set the field in the database as BLOB and in the entity as byte[];
How do I convert the object FileWriter
for byte?
Regarding item 4 I intend to use the p:fileDownload
of the Primefaces. But the same awaits a StreamedContent
, ie. I will have to perform a new conversion!
I may be wrong in some of these notes. And I ask for everyone’s help to solve this problem!
Limit the question to a specific problem and provide sufficient detail to get an adequate answer.
– Renan Gomes
Thanks for the editing. You think I should provide more than to get an adequate response?
– karanalpe