Ahmad Mirza
Ahmad Mirza

Reputation: 31

How to show images from source stored in database in adf 12c

I am developing fusion web app in adf 12c with database 12c.

Here is the code of image showing on .jsf page.

<af:image id="i1" source="#{resource['UplDwn_Data:1.png']}"/>

Now i want to show images from the source stored in database. I have done successfully uploading images and saving source value in database, not storing image as BLOB type in database.

I am storing full source value in database e.g. "#{resource['UplDwn_Data:1.png']}"

Here is the code of input text field where i am getting data from database.

<af:inputText value="#{bindings.Image.inputValue}" 
  label="Picture DB" rendered="true" simple="true" 
  required="#{bindings.Image.hints.mandatory}" 
  columns="#{bindings.Image.hints.displayWidth}" 
  maximumLength="#{bindings.Image.hints.precision}" 
  shortDesc="#{bindings.Image.hints.tooltip}" id="it66" 
  binding="#{FileManageBean.dbValue}">
 <f:validator binding="#{bindings.Image.validator}"/>
</af:inputText>

Here is screen shot of above code after running in browser: data stored in database

I want to use this data as image source to show on .jsf page.

If you have any other idea will be really appreciable, but remember i don't want to store image as blob type in database.

Upvotes: 0

Views: 658

Answers (1)

Shay Shmeltzer
Shay Shmeltzer

Reputation: 3721

Just set the source attribute of an af:image to the value coming from the DB. Note that the value in the DB should be the full URL (or at least a relative URL) to the image.

Upvotes: 1

Related Questions