0

Im using Primefaces photocam component. I can perform capture by using:

PF('photoCam').capture();

But how to perform this operation from backing bean?

I have a binding:

<p:photoCam widgetVar="pc" binding="#{photoCamView.photoCam}" listener="#{photoCamView.oncapture}" update="photo" />

But org.primefaces.component.photocam.PhotoCam does not have "capture" method.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Daveron
  • 67
  • 1
  • 6
  • `PF('photoCam').capture();` is javascript so effectively you ask what is mentioned in the duplicate... (amd wjat is it's generic title) Always try to generalize the problem – Kukeltje May 03 '20 at 22:08
  • and please edit your question. Code is not visible – Kukeltje May 03 '20 at 22:09
  • 1
    By your edit, the question got completely chameleonized... It now is a different question since the original problem is solved by the duplicate. I reverted these edits. Please create a new question with the new problem. And post version info and more... – Kukeltje May 04 '20 at 07:06
  • I need a method to take a screenshot from backing bean. You can bind CamPhoto objet to p:photoCam, but it does not have "capture" method. You proposed using Primefaces.current, as a duplicate, but it does not work either. Im not sure why according to you its a different question. Your proposed solution does not work. For me there is no difference which method to use, bound object or primefaces.current. None of those methods work. – Daveron May 04 '20 at 07:21
  • The proposed duplicates has different solutions for calling javascript from a bean, `PrimeFaces.current` being one of them, but it requires ajax, the other solutions might to or not. Read them carefully, this IS your problem. But your attempt to implement this was not one of the solutions in the duplicate but a wrong combination of ajax and non-ajax, Effectively a new question, not related to `p:photoCam` directly but yes resulting in an error related to it since it is what you try to call – Kukeltje May 04 '20 at 07:42
  • My mistake. You are fully right. Adding ajax helped. Thanks very much!!!! – Daveron May 04 '20 at 08:29

0 Answers0