1

What is the proper way , using MultiActionController? I got in my Restaurant class:

private byte[] logo;

In my database I got table BLOB image. By using hibernate, it saves to my database properly by:

<tr>
<td>Logo :</td>
<td>< input type="file" name="logo" /></td>
</tr>

But i dont know how to shows this image on another site. Maybe:

< img src="<%=("restaurant.logo")%>" alt="Upload Image" />

?

3 Answers 3

1

You should do something like this, create a new field in your Restaurant and have the byte[] converted to Image and use that field.

Sign up to request clarification or add additional context in comments.

1 Comment

A "Spring MVC + Hibernate + Maven" fully working example: sites.google.com/site/adrienitnotes/java/…
0

If I understand your problem, you need a controller getting your picture from database and returning it as a stream to web browser.

You can for example map controller method with request: /restaurant/logo/{id}

Then you should just type

<img src="<c:url value='/restaurant/logo/${restaurant.id}' />" alt="Upload Image" />

I you add more of code, I'll be able to give you more hints.

Comments

0

Please do have a look here!

This is more generic and points at all types of files upload and download.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.