When we store the images in database using blog type, we would like to retrieve them and display them on the screen. This can be done by creating a servlet and configuring it in the web.xml using the following steps
Step1 Create jsff with the af:image component and configure the source as below. The parameters that we send to the servlet should be enough to send as bind parameters to the image table and retrieve the image
Step2 Create the servlet to retrieve the image from the database as below
Step3 Configure the web.xml as shown below
Notes
1. Parameters passed to the servlet via af:image source tag should change then only the image on the screen will be refreshed, so better to pass the version number
2. If this application is deployed as library and used as dependency in another application, configure the servlet in the application from where this library is being referenced
Step1 Create jsff with the af:image component and configure the source as below. The parameters that we send to the servlet should be enough to send as bind parameters to the image table and retrieve the image
Step2 Create the servlet to retrieve the image from the database as below
Step3 Configure the web.xml as shown below
Notes
1. Parameters passed to the servlet via af:image source tag should change then only the image on the screen will be refreshed, so better to pass the version number
2. If this application is deployed as library and used as dependency in another application, configure the servlet in the application from where this library is being referenced
No comments:
Post a Comment