Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:38:52+00:00 2026-06-16T16:38:52+00:00

I am using primefaces photoCam component exactly as explained in https://www.primefaces.org/showcase/ui/multimedia/photoCam.xhtml . unfortunately, unlike

  • 0

I am using primefaces photoCam component exactly as explained in
https://www.primefaces.org/showcase/ui/multimedia/photoCam.xhtml . unfortunately, unlike in the showcase my photoCam example, mine does not render. I have tried it on Firefox and Chrome the code is as follows:

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

<h:form>  
<h:panelGrid columns="3">  
    <p:photoCam widgetVar="pc" listener="#{photoCamBean.oncapture}" update="photos"/>  

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

    <p:imageSwitch effect="zoom" id="photos">  
        <ui:repeat value="#{photoCamBean.photos}" var="photo">  
            <p:graphicImage value="/photocam/#{photo}.png" />  
        </ui:repeat>  
    </p:imageSwitch>  
</h:panelGrid>  
</h:form>

</ui:composition>

And the bean

@ManagedBean
@ViewScoped
public class PhotoCamBean {  

private List<String> photos = new ArrayList<String>();

private String getRandomImageName() {
            int i = (int) (Math.random() * 10000000);

            return String.valueOf(i);
    }

public List<String> getPhotos() {
    return photos;
}    

public void oncapture(CaptureEvent captureEvent) {
    String photo = getRandomImageName();
    this.photos.add(0,photo);
    byte[] data = captureEvent.getData();

            ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
            String newFileName = servletContext.getRealPath("") + File.separator + "photocam" + File.separator + photo + ".png";

            FileImageOutputStream imageOutput;
            try {
                    imageOutput = new FileImageOutputStream(new File(newFileName));
                    imageOutput.write(data, 0, data.length);
                    imageOutput.close();
            }
    catch(Exception e) {
                    throw new FacesException("Error in writing captured image.");
            }
}

}

The primefaces showcase photoCam renders a canvas with an adobe flash confirmation window but mine doesn’t, what am i missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:38:54+00:00Added an answer on June 16, 2026 at 4:38 pm

    Adding the meta tag in the head section of the page solves the problem as shown:

    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
    
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </h:head>
    
    <h:form>  
    <h:panelGrid columns="3">  
    <p:photoCam widgetVar="pc" listener="#{photoCamBean.oncapture}" update="photos"/>  
    
    <p:commandButton type="button" value="Capture" onclick="pc.capture()"/>  
    
    <p:imageSwitch effect="zoom" id="photos">  
        <ui:repeat value="#{photoCamBean.photos}" var="photo">  
            <p:graphicImage value="/photocam/#{photo}.png" />  
        </ui:repeat>  
    </p:imageSwitch>  
    </h:panelGrid>  
    </h:form>
    </ui:composition>
    

    I was able to view the canvas with an adobe flash confirmation window simply by adding the meta tag. Thank you all for your contribution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the requestContext demo example in my system http://www.primefaces.org/showcase-labs/ui/requestContext.jsf I am getting the following
I am using primefaces(3.0) scheduler component. http://www.primefaces.org/showcase-labs/ui/schedule.jsf As we can see here there there
I'm trying to display an alert using Primefaces Dialog component in my JSF page.
I am using primefaces p:schedule component to display events as shown here . p:schedule
I'm using Primefaces' Terminal component and JSch to ssh to a remote desktop. With
I'm using primefaces upload file component everything works fine : my problem that I
I am using primefaces with JSF. I need a input component that allows users
I am using the Primefaces wizard component. On one tab I am dynamically creating
I'm using primefaces layout component and having difficulty with a component in an embedded
I am using primefaces' calendar component. I have a corresponding string in VO. While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.