PhotoCam is not working

Locked
ybendek
Posts: 102
Joined: 05 Aug 2011, 17:52

22 Jun 2015, 03:42

Hi...

I have been using PhotoCam component with pf before, but now applying RIO layaout and theme something fail, basically the listener is not triggered, I'm not sure if its something related with Rio or PF (5.2) because before of using Rio it works :(

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

22 Jun 2015, 10:53

I tested with 5.2 but I didn't see a bug. Can you please attach a sample test.xhtml and TestBean.java for us to replicate?

ybendek
Posts: 102
Joined: 05 Aug 2011, 17:52

22 Jun 2015, 19:22

aragorn wrote:I tested with 5.2 but I didn't see a bug. Can you please attach a sample test.xhtml and TestBean.java for us to replicate?
Sure.

I'm using a basic example

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="content">
        <h:form id="formCmp">  
            <p:photoCam widgetVar="pc" listener="#{testBean.oncapture}" forceFlash="true"/>
            <p:commandButton type="button" value="Capture" onclick="PF('pc').capture()"/>
        </h:form> 
    </ui:define>

</ui:composition>

Code: Select all

@ManagedBean(name = "testBean")
@SessionScoped
public class TestMngBean {
    public void oncapture(CaptureEvent captureEvent){
        LOG.log(Level.INFO, "capture photo");    
    }
}
I'm using PF 5.2 and MyFaces 2.2.8. With this code, it's displayed in screen the webcam image, however, when I press the button, the listener is never triggered.

With chrome I'm tracking the network data and I found some interesting information, when the button is pressed two items are displayed:

1) the captured image (GET Method)
2) A POST method to the jsf file with the following detail:

Code: Select all

<partial-response>
 <error>
   <error-name>org.apache.myfaces.view.facelets.el.ContextAwareMethodNotFoundException</error-name>
   <error-message>
        <![CDATA[javax.el.MethodNotFoundException: Return type 'void' of method 'oncapture' in 'class com.unitas.view.TestMngBean' does not match 'interface java.util.List']]>
    </error-message>
  </error>
</partial-response>

For some reason that I don't understand, now is required that the listener method returns a List object o_O

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

24 Jun 2015, 22:24

I tested with your code but I didn't see.
Test;
- created jetty-web.xml (WEB-INF/jetty-web.xml)
and added in its

Code: Select all

<?xml version="1.0"?>
  <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
  "http://jetty.mortbay.org/configure.dtd">

<Configure id="WebAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="maxFormContentSize" type="int">600000</Set>
</Configure>
- in testView.java

Code: Select all

package org.primefaces.rio.view;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import org.primefaces.event.CaptureEvent;

@ManagedBean(name = "testBean")
@SessionScoped
public class TestView {
    public void oncapture(CaptureEvent captureEvent){
        System.out.println("capture photo");    
    }
}
-in test.xhml

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="content">
        <h:form id="formCmp">  
            <p:photoCam widgetVar="pc" listener="#{testBean.oncapture}" forceFlash="true"/>
            <p:commandButton type="button" value="Capture" onclick="PF('pc').capture()"/>
        </h:form> 
    </ui:define>

</ui:composition>

Locked

Return to “Rio”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests