Hey, I have created the code below for you for Displaying an image and text in a JSP.
Code:
ServletOutputStream sOS = response.getOutputStream();
img = InputStream post.getResponseBodyAsStream();
InputStream in = new BufferedInputStream(picture);
String str = post.getResponseHeader("Content-Type").getValue();
String len = post.getResponseHeader("Content-Length").getValue();
response.setContentType(str);
byte[] buf = new byte[Integer.parseInt(len)];
int bytesRead;
while ((bytesRead = in.read(buf)) != -1) {
sOS.write(buf, 0, BytesRead);
}
sOS.flush();
response.setContentType("text / html");
sOS.System.out.println("BLalalLALAllal");
sOS.close();
Bookmarks