O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Capturing images with photoCam

The photoCam component supports taking images with the attached camera and sending them to the JSF backend data model.

How to do it...

A simple definition for capturing an image with the photoCam component would be as follows:

<p:photoCam widgetVar="pc" listener="#{photoCamController.onCapture}" update="capturedImage"/>

<p:graphicImage id="capturedImage" value="#{photoCamController.capturedImage}" />update="capturedImage"/>

<p:commandButton type="button" value="Capture" onclick="pc.capture()"/>

How it works...

The captured image is triggered via the client-side JavaScript method capture. The button declared in the preceding sample invokes the capture method via the widget variable defined for the photoCam component. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required