how to specify the src come in a session, java problems tips" /> how to specify the src come in a session. Get java problems tips from" />

how to specify the src come in a session

Category: Web Develop
2011-06-09 02:49:45

Sponsored Links

<img src="D:\\123.jpg"/>

so that I can show on the website 123.jpg

the jpg file but if I was backstage java program that extracted from the database how to do?
I can now embed java code on the page the file from the session raised.

File file = request.getSession().getValue("imageFile");

It can also be converted into a byte File form.
but how to establish contact with the img tag it?

I do not want to use a temporary file in the form. Do not want to generate temporary files on the server, you want to turn off the IE image files with user automatically released.

Thank you!

Sponsored Links

2011-06-09 03:00:32

File file = request.getSession().getValue("imageFile");

<img src="${imgPath}"/>

I not want to use a temporary file in the form. Do not want to generate temporary files on the server does not generate files how
show it?
can generate temporary files, page cleared off the line

2011-06-09 03:12:49
src write directly on the page with pictures or servlet
2011-06-09 03:24:50

public void showpic(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url = request.getParameter("url");
String suffix = request.getParameter("suffix");
response.setContentType("image/" + suffix + ";charset=GB2312");
OutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(new File(url));
int i = 0;
byte buffer[] = new byte[8192];
while ((i =, 0, buffer.length)) != -1) {
out.write(buffer, 0, i);
in = null;

previously written a method that reads a file and stream output picture him as a required parameter is the absolute path of the picture and the picture of the suffix Name
2011-06-09 03:36:06
<img src = "<% = taken out%>" />
2011-06-09 03:52:15
save relative path, take the easy
2011-06-09 04:04:14

so you can verify code practice
2011-06-09 04:14:44

path you have found no pictures??? there should be a picture file, a file there is a path
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.