I have an image stored as a byte array and a caption as string under a pojo I call media. How do I return both the byte array and the string to the browser since I can't call both getoutputstream()
and getwriter()
? Thanks.
Asked
Active
Viewed 15 times
0

Tom11
- 2,419
- 8
- 30
- 56

oluseunakin
- 1
- 2
-
You don't at all need the `byte[]` during generating HTML output. Just some identifier to use in `
` is sufficient. – BalusC Aug 10 '16 at 06:50
-
The image is stored as a byte[] in the database. Can you please show me a snippet as what you are explaining. The image is a variable in a pojo class that has other variables too like the caption. – oluseunakin Aug 10 '16 at 07:02
-
Just follow the duplicate link. This has already been answered years ago. – BalusC Aug 10 '16 at 07:03
-
I saw your comment on a similar question that advised that the uploaded file should be stored in a directory and the path to the directory stored on database, please show me how that can be done? – oluseunakin Aug 10 '16 at 07:12
-
That's answered here: http://stackoverflow.com/q/18664579 If you want more answers to Servlet development related questions, continue here: https://servlets.zeef.com – BalusC Aug 10 '16 at 07:14