0

I try to learn jsf and I like to play with image processing, so I'm trying to set up an application that shows a picture that will be processed in different ways depending on user action. I've got it working but I use Servlet#doGet().

I feel it is bad practice to mix custom-Servlet with jsf-style. (Is it really?) So how can this be done with beans only?

I have found Forcing a save as dialogue from any web browser from JSF application but I want to see the image embedded, not as a download.

Community
  • 1
  • 1
Gyro Gearloose
  • 936
  • 1
  • 5
  • 21
  • I don't know how you are going to do it. I would do it with Primefaces - because I use Primefaces. http://www.primefaces.org/showcase/ui/multimedia/graphicImage.xhtml But there is nothing really wrong with using a servlet for that particular job. Unless you have an actual problem you're not sharing? – Gimby Nov 16 '15 at 14:54
  • No /actual/ problem, as of now, but I stumbled on a few until I got it working. One was that the backing bean was not initialized when the servlet is called. – Gyro Gearloose Nov 16 '15 at 15:00
  • As per above comment, in addition to the duplicate, it would help to carefully read http://stackoverflow.com/questions/2340406/how-to-retrieve-and-display-images-from-a-database-in-a-jsp-page and http://stackoverflow.com/questions/8207325/display-dynamic-image-from-database-with-pgraphicimage-and-streamedcontent to understand how it works "under the covers". Somehow, many starters seem to incorrectly expect that images are requested in the same request as the HTML page itself. – BalusC Nov 16 '15 at 15:07
  • I don't especially like to use omnifaces. Can it be done without? – Gyro Gearloose Nov 16 '15 at 15:07
  • Certainly it's possible. Otherwise OmniFaces wouldn't have been able to do it in first place. – BalusC Nov 16 '15 at 15:08
  • OK, I've tested that h:graphicalImage.value cannot handle InputStream. As a novice I don't want to work with the whole zoo of tag brands and as my original solution with Servlet is technically working fine, I ignore my bad feelings about breaking architectural integrity and mixing styles and will stick to custom-servlets until I know better. – Gyro Gearloose Nov 16 '15 at 18:04

0 Answers0